Skip to content

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcoder committed Jan 20, 2021
1 parent b302d72 commit e906959
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cmd/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func put(cmd *cobra.Command, params []string){

for _, path := range params {

index := strings.LastIndexAny(path, "\\")
index := strings.LastIndexAny(path, "/")

var upload string

Expand All @@ -92,6 +92,19 @@ func put(cmd *cobra.Command, params []string){

if overwrite {

//一点点小bug,没有办法的解决办法
//好傻逼啊!

err := os.Chdir(path[0:index+1])

if err != nil {

fmt.Println("err")

}

path = upload

putPolicy = storage.PutPolicy{

Scope: fmt.Sprintf("%s:%s", bucket, path),
Expand Down Expand Up @@ -130,6 +143,7 @@ func put(cmd *cobra.Command, params []string){
},
}

fmt.Println(upload)

err = formUploader.PutFile(context.Background(), &ret, upToken, upload, path, &putExtra)

Expand Down

0 comments on commit e906959

Please sign in to comment.