From 5bd8db4d671768a5d6e1c300c7ce1ad920f7d8e0 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Wed, 20 Apr 2022 17:50:48 +0100 Subject: [PATCH 1/2] 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 --- cmd/dump.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/dump.go b/cmd/dump.go index 418042559874c..9f90afd6ebd36 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -160,7 +160,12 @@ func runDump(ctx *cli.Context) error { fatal("Deleting default logger failed. Can not write to stdout: %v", err) } } else { - fileName = strings.TrimSuffix(fileName, path.Ext(fileName)) + for _, suffix := range outputTypeEnum.Enum { + if strings.HasSuffix(fileName, "."+suffix) { + fileName = strings.TrimSuffix(fileName, "."+suffix) + break + } + } fileName += "." + outType } setting.LoadFromExisting() From 19f4b47ab0be58b81dcdae8f4ee86e7400389324 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 20 Apr 2022 19:37:16 +0200 Subject: [PATCH 2/2] fix Enum --- cmd/dump.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/dump.go b/cmd/dump.go index 9f90afd6ebd36..f72ef05e948f9 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -86,7 +86,7 @@ func (o outputType) String() string { } var outputTypeEnum = &outputType{ - Enum: []string{"zip", "rar", "tar", "sz", "tar.gz", "tar.xz", "tar.bz2", "tar.br", "tar.lz4"}, + Enum: []string{"zip", "tar", "tar.sz", "tar.gz", "tar.xz", "tar.bz2", "tar.br", "tar.lz4"}, Default: "zip", }