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

Closed
opened 2025-11-02 08:20:31 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @patrickbucher on GitHub (Apr 19, 2022).

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

Originally created by @patrickbucher on GitHub (Apr 19, 2022). ### 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 ```go 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
GiteaMirror added the type/bug label 2025-11-02 08:20:31 -06:00
Author
Owner

@zeripath commented on GitHub (Apr 20, 2022):

Regression from #18000

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

@zeripath commented on GitHub (Apr 20, 2022): Regression from #18000 Sorry about this. I should have checked the PR more closely.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8843