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

When dumping trim the standard suffices instead of a random suffix #19440

Merged
merged 2 commits into from
Apr 20, 2022

Conversation

zeripath
Copy link
Contributor

Instead of using the path.Ext() to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix #19424

Signed-off-by: Andrew Thornton art27@cantab.net

Instead of using the `path.Ext()` to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix go-gitea#19424

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Contributor Author

This is a change from the mechanism proposed in #18000

Instead of trimming the last extension no matter what it is - we just trim off the first of our known suffices before adding the correct type back on.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 20, 2022
@zeripath zeripath requested a review from Gusted April 20, 2022 16:54
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 20, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 20, 2022
@wxiaoguang
Copy link
Contributor

Maybe there should be more fixes for #18000

  1. rar is not supported by https://github.com/mholt/archiver, it declares .rar (read-only), it was added wrongly by Fix outType on gitea dump #18000
  2. zstandard (zst) could be added, IIRC some users asked for it.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 20, 2022

And "sz" seems not ideal. It should be "tar.sz" like "tar.gz", ".sz" is only a compression, not a archiver IIRC.

@6543
Copy link
Member

6543 commented Apr 20, 2022

@wxiaoguang changed

@6543 6543 requested a review from wxiaoguang April 20, 2022 17:37
@6543 6543 merged commit 1e319ba into go-gitea:main Apr 20, 2022
@6543
Copy link
Member

6543 commented Apr 20, 2022

please backport

6543 added a commit to 6543-forks/gitea that referenced this pull request Apr 20, 2022
…o-gitea#19440)

* When dumping trim the standard suffices instead of a random suffix

Instead of using the `path.Ext()` to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix go-gitea#19424

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fix enum with to have correct supported types only

Co-authored-by: 6543 <6543@obermui.de>
@6543
Copy link
Member

6543 commented Apr 20, 2022

-> #19447

@6543 6543 added the backport/done All backports for this PR have been created label Apr 20, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 20, 2022
* giteaofficial/main:
  When dumping trim the standard suffices instead of a random suffix (go-gitea#19440)
  Add uploadpack.allowAnySHA1InWant to allow --filter=blob:none with older git clients (go-gitea#19430)
  Don't allow merging PR's which are being conflict checked (go-gitea#19357)
  doc: add brief intro on using traefik as reverse-proxy (go-gitea#19432)
  Fix panic in team repos API (go-gitea#19431)
  When updating mirror repo intervals by API reschedule next update too (go-gitea#19429)
  Fix nil error when some pages are rendered outside request context (go-gitea#19427)
  Add Helm Chart registry (go-gitea#19406)
zeripath added a commit that referenced this pull request Apr 20, 2022
…19440) (#19447)

* When dumping trim the standard suffices instead of a random suffix

Instead of using the `path.Ext()` to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix #19424

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fix enum with to have correct supported types only

Co-authored-by: 6543 <6543@obermui.de>

Co-authored-by: zeripath <art27@cantab.net>
@zeripath zeripath deleted the fix-19424-trim-standard-suffices branch April 22, 2022 16:10
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 24, 2022
…o-gitea#19440)

* When dumping trim the standard suffices instead of a random suffix

Instead of using the `path.Ext()` to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix go-gitea#19424

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fix enum with to have correct supported types only

Co-authored-by: 6543 <6543@obermui.de>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gitea dump: .tar.xz suffix added after only .xz extension was trimmed
6 participants