Skip to content

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

Closed
@patrickbucher

Description

@patrickbucher

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions