Skip to content

Commit 5380fd5

Browse files
authored
fixed duplicate attachments on dump on windows (#28019)
Hi, This PR fixes #27988. The use of `path.join`(which uses `/` as the file separator) to construct paths and comparing them with paths constructed using `filepath.join`(which uses platform specific file separator) is the root cause of this issue. The desired behavior is to ignore attachments when dumping data directory. Due to the what's mentioned above, the function `addRecursiveExclude` is not actually ignoring the attachments directory and is being written to the archive. The attachment directory is again added to the archive (with different file separator as mentioned in the issue) causing a duplicate entry on windows. The solution is to use `filepath.join` in `addResursiveExclude` to construct `currentAbsPath`.
1 parent f586937 commit 5380fd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func addRecursiveExclude(w archiver.Writer, insidePath, absPath string, excludeA
452452
return err
453453
}
454454
for _, file := range files {
455-
currentAbsPath := path.Join(absPath, file.Name())
455+
currentAbsPath := filepath.Join(absPath, file.Name())
456456
currentInsidePath := path.Join(insidePath, file.Name())
457457
if file.IsDir() {
458458
if !util.SliceContainsString(excludeAbsPath, currentAbsPath) {

0 commit comments

Comments
 (0)