aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/dump.go
diff options
context:
space:
mode:
authorAnudeep Reddy <anudeepc85@gmail.com>2023-11-14 06:45:45 +0530
committerGitHub <noreply@github.com>2023-11-14 02:15:45 +0100
commit5380fd5d6d9fc1f1b280bf39a3906555985987ee (patch)
tree40e360a9f4d2ac0968f32b565413fc506a11c97b /cmd/dump.go
parentf586937297d6d77d0c4b1fe877154d7f39763429 (diff)
downloadgitea-5380fd5d6d9fc1f1b280bf39a3906555985987ee.tar.gz
gitea-5380fd5d6d9fc1f1b280bf39a3906555985987ee.zip
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`.
Diffstat (limited to 'cmd/dump.go')
-rw-r--r--cmd/dump.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/dump.go b/cmd/dump.go
index 97f292ae09..69ecdcec12 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -452,7 +452,7 @@ func addRecursiveExclude(w archiver.Writer, insidePath, absPath string, excludeA
return err
}
for _, file := range files {
- currentAbsPath := path.Join(absPath, file.Name())
+ currentAbsPath := filepath.Join(absPath, file.Name())
currentInsidePath := path.Join(insidePath, file.Name())
if file.IsDir() {
if !util.SliceContainsString(excludeAbsPath, currentAbsPath) {