fix self-copy guard (#2623)
This commit is contained in:
1 parent
c283890b82
commit
4e4701addd
1 file changed
+1
-1
@@ -124,7 +124,7 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64,
|
|||||||
dst = newPath
|
dst = newPath
|
||||||
}
|
}
|
||||||
|
|
||||||
if rel, err := filepath.Rel(src, dst); err == nil && rel != "." && !strings.HasPrefix(rel, "..") {
|
if rel, err := filepath.Rel(src, dst); err == nil && rel != "." && filepath.IsLocal(rel) {
|
||||||
errs <- fmt.Errorf("cannot copy %s into a subdirectory of itself", src)
|
errs <- fmt.Errorf("cannot copy %s into a subdirectory of itself", src)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user