From 5bd8db4d671768a5d6e1c300c7ce1ad920f7d8e0 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Wed, 20 Apr 2022 17:50:48 +0100 Subject: [PATCH] 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 418042559874..9f90afd6ebd3 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()