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: .tar.xz suffix added after only .xz extension was trimmed #19424

Closed
patrickbucher opened this issue Apr 19, 2022 · 1 comment · Fixed by #19440
Closed

gitea dump: .tar.xz suffix added after only .xz extension was trimmed #19424

patrickbucher opened this issue Apr 19, 2022 · 1 comment · Fixed by #19440
Labels
Milestone

Comments

@patrickbucher
Copy link

Description

My server's disk usage grew after the last update. If figured out that my backup files were stored twice: Once with the proper .tar.xz extension, and once with a .tar.tar.xz extension.

The problem is, that more is added as an extension than was trimmed before: https://github.com/go-gitea/gitea/blob/main/cmd/dump.go#L163

package main

import (
	"fmt"
	"path"
	"strings"
)

const (
	fileName = "gitea.dump.tar.xz"
	outType  = "tar.xz"
)

func main() {
	fileName := strings.TrimSuffix(fileName, path.Ext(fileName))
	fileName += "." + outType
	fmt.Println(fileName)
}

Output:

gitea.dump.tar.tar.xz

Gitea Version

1.16.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.25.1

Operating System

Ubuntu 20.04 LTS

How are you running Gitea?

Directly on a VM, i.e. not in a container.

Database

PostgreSQL

@lunny lunny added this to the 1.16.6 milestone Apr 19, 2022
zeripath added a commit to zeripath/gitea that referenced this issue Apr 20, 2022
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

Regression from #18000

Sorry about this. I should have checked the PR more closely.

6543 added a commit that referenced this issue Apr 20, 2022
…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 #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 added a commit to 6543-forks/gitea that referenced this issue 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>
zeripath added a commit that referenced this issue 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>
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this issue 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants