Skip to content

Commit

Permalink
fix(path): replaced filepath methods with pathutil for remotepath (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlangzi authored Mar 24, 2023
1 parent b346be7 commit 7c93b79
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cmd
import (
"fmt"
"os"
"path/filepath"

"github.com/0chain/gosdk/core/pathutil"
"github.com/0chain/gosdk/zboxcore/sdk"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -38,7 +38,7 @@ var renameCmd = &cobra.Command{
}
remotePath := cmd.Flag("remotepath").Value.String()
destName := cmd.Flag("destname").Value.String()
oldName := filepath.Base(remotePath)
oldName := pathutil.Dir(remotePath)
if oldName == destName {
fmt.Println(remotePath + " renamed")
return
Expand Down
4 changes: 2 additions & 2 deletions cmd/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package cmd
import (
"fmt"
"os"
"path/filepath"
"time"

"github.com/0chain/gosdk/core/common"
"github.com/0chain/gosdk/core/pathutil"
"github.com/0chain/gosdk/zboxcore/fileref"
"github.com/0chain/gosdk/zboxcore/sdk"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -70,7 +70,7 @@ var shareCmd = &cobra.Command{

var fileName string

_, fileName = filepath.Split(remotepath)
_, fileName = pathutil.Split(remotepath)
refereeClientID := cmd.Flag("clientid").Value.String()

revoke, _ := cmd.Flags().GetBool("revoke")
Expand Down
4 changes: 2 additions & 2 deletions cmd/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package cmd

import (
"os"
"path/filepath"
"strings"
"sync"

thrown "github.com/0chain/errors"
"github.com/0chain/gosdk/core/pathutil"
"github.com/0chain/gosdk/zboxcore/sdk"
"github.com/0chain/gosdk/zboxcore/zboxutil"
"github.com/0chain/zboxcli/util"
Expand Down Expand Up @@ -168,7 +168,7 @@ func fullPathAndFileNameForUpload(localPath, remotePath string) (string, string,
}

fullRemotePath := zboxutil.GetFullRemotePath(localPath, remotePath)
_, fileName := filepath.Split(fullRemotePath)
_, fileName := pathutil.Split(fullRemotePath)

return fullRemotePath, fileName, nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/0chain/errors v1.0.3
github.com/0chain/gosdk v1.8.15-0.20230324003013-f8040f52bd92
github.com/0chain/gosdk v1.8.15-0.20230324074439-e95aedb29c87
github.com/icza/bitio v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20221123040931-4a3feacdb97c h1:TDqF7VJa7uLLlEs
github.com/0chain/common v0.0.6-0.20221123040931-4a3feacdb97c/go.mod h1:OxV9kVgVzAPgGHHPcS/aUSL2ZxNvKDU6jPoggKMbqns=
github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM=
github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc=
github.com/0chain/gosdk v1.8.15-0.20230324003013-f8040f52bd92 h1:1yzlfh9EPDWb3BgHCgYAfufNAEc7Q4o2WDWYPIITLLI=
github.com/0chain/gosdk v1.8.15-0.20230324003013-f8040f52bd92/go.mod h1:cBm7vTDxG+QvWb3SAnsYaOnLkBhUXc5UmtJn/QfVWKI=
github.com/0chain/gosdk v1.8.15-0.20230324074439-e95aedb29c87 h1:bJpPhWlCv0a1nMKneWZT/GUurRLB4EPuWf2mRMEiPNc=
github.com/0chain/gosdk v1.8.15-0.20230324074439-e95aedb29c87/go.mod h1:cBm7vTDxG+QvWb3SAnsYaOnLkBhUXc5UmtJn/QfVWKI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw=
Expand Down

0 comments on commit 7c93b79

Please sign in to comment.