Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitea dump doubles all attachments on Windows #27988

Closed
crackedmind opened this issue Nov 10, 2023 · 0 comments · Fixed by #28019
Closed

gitea dump doubles all attachments on Windows #27988

crackedmind opened this issue Nov 10, 2023 · 0 comments · Fixed by #28019
Labels

Comments

@crackedmind
Copy link

crackedmind commented Nov 10, 2023

Description

i have 1 attachment, for example
data\attachments\2\a\2a08a9d1-9b6f-4c6b-b2de-9bed9505ba22

after gitea dump in dump file i found two copies of each attachment
but one of them writed as data/attachments/2/a/2a08a9d1-9b6f-4c6b-b2de-9bed9505ba22
second as data/attachments/2\a\2a08a9d1-9b6f-4c6b-b2de-9bed9505ba22

Gitea Version

1.20.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.42.0.windows.2

Operating System

Windows 11

How are you running Gitea?

from command line gitea-1.20.5-windows-4.0-amd64.exe

Database

SQLite

6543 pushed a commit that referenced this issue Nov 14, 2023
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`.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Nov 14, 2023
Hi,

This PR fixes go-gitea#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`.
lunny pushed a commit that referenced this issue Nov 14, 2023
Backport #28019 by @anudeepreddy

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`.

Co-authored-by: Anudeep Reddy <anudeepc85@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 30, 2023
fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
Hi,

This PR fixes go-gitea#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`.
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Hi,

This PR fixes go-gitea#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`.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant