Skip to content

Commit

Permalink
When dumping trim the standard suffices instead of a random suffix
Browse files Browse the repository at this point in the history
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 <art27@cantab.net>
  • Loading branch information
zeripath committed Apr 20, 2022
1 parent a7f0ce6 commit 5bd8db4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5bd8db4

Please sign in to comment.