Skip to content

Commit af69b63

Browse files
committed
fix(filer): cp file to volume error
1 parent 17cd0de commit af69b63

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

cmd/volumes.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,10 @@ func (d *DryccCmd) volumesClientCp(appID, src, dst string) error {
384384
return err
385385
}
386386
if dirs, _, err := volumes.ListDir(s.Client, appID, volumeID, volumePath, 3000); err == nil {
387-
if len(dirs) == 1 && dirs[0].Type == "file" {
387+
names := strings.Split(strings.Trim(src, "/"), "/")
388+
if len(dirs) == 1 && dirs[0].Type == "file" && strings.HasSuffix(strings.Trim(volumePath, "/"), names[len(names)-1]) {
388389
return fmt.Errorf("the volume path cannot be an existing file")
389390
}
390-
} else if strings.Contains(fmt.Sprint(err), "no such file or directory") {
391-
return err
392391
}
393392
if file, err := os.Stat(src); err == nil && file.IsDir() {
394393
volumePath = mergeDestDir(volumePath, src)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22
55
require (
66
github.com/containerd/console v1.0.4
77
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
8-
github.com/drycc/controller-sdk-go v0.0.0-20240905080608-287c054d88fa
8+
github.com/drycc/controller-sdk-go v0.0.0-20240914012909-575b73557eda
99
github.com/drycc/pkg v0.0.0-20240225112316-78fc9239f51f
1010
github.com/minio/selfupdate v0.6.0
1111
github.com/olekukonko/tablewriter v0.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
77
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
88
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
99
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
10-
github.com/drycc/controller-sdk-go v0.0.0-20240905080608-287c054d88fa h1:mdr4Z80ioWRP9o/4mpW1NwICPirXvvlyK7cCV3pprvc=
11-
github.com/drycc/controller-sdk-go v0.0.0-20240905080608-287c054d88fa/go.mod h1:n6eQe1irJqjwLo/7t9+Dhdv6faSESQN+ATnZRBP3/Uc=
10+
github.com/drycc/controller-sdk-go v0.0.0-20240914012909-575b73557eda h1:mRCAj1UoeNWhwDwLj7VEOHMobziBxjvNJ//n+pfqIXs=
11+
github.com/drycc/controller-sdk-go v0.0.0-20240914012909-575b73557eda/go.mod h1:n6eQe1irJqjwLo/7t9+Dhdv6faSESQN+ATnZRBP3/Uc=
1212
github.com/drycc/pkg v0.0.0-20240225112316-78fc9239f51f h1:kgjvUQJeAszDoU1Vo4vTTE92KI8Av3JPb6Qn890niXg=
1313
github.com/drycc/pkg v0.0.0-20240225112316-78fc9239f51f/go.mod h1:n+QxGif6ha9CEoxVnlipxb9IdmerybcUSzTEDFkvjiA=
1414
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=

0 commit comments

Comments
 (0)