fix self-copy guard (#2623)

This commit is contained in:
valoq authored and GitHub committed 2026-06-20 07:09:46 +02:00
1 parent c283890b82
commit 4e4701addd
1 file changed
+1 -1
+1 -1
View File
@@ -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
} }