Skip to content

Commit 5bd8db4

Browse files
committed
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 <[email protected]>
1 parent a7f0ce6 commit 5bd8db4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/dump.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ func runDump(ctx *cli.Context) error {
160160
fatal("Deleting default logger failed. Can not write to stdout: %v", err)
161161
}
162162
} else {
163-
fileName = strings.TrimSuffix(fileName, path.Ext(fileName))
163+
for _, suffix := range outputTypeEnum.Enum {
164+
if strings.HasSuffix(fileName, "."+suffix) {
165+
fileName = strings.TrimSuffix(fileName, "."+suffix)
166+
break
167+
}
168+
}
164169
fileName += "." + outType
165170
}
166171
setting.LoadFromExisting()

0 commit comments

Comments
 (0)