From 4e4701addd3e10eb2f2f8ddfbed5f0ca29c15b04 Mon Sep 17 00:00:00 2001 From: valoq Date: Sat, 20 Jun 2026 07:09:46 +0200 Subject: [PATCH] fix self-copy guard (#2623) --- copy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy.go b/copy.go index 184b3797..bc6f9218 100644 --- a/copy.go +++ b/copy.go @@ -124,7 +124,7 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64, 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) continue }