Skip to content

Commit

Permalink
Recognize .jsonc files automatically (XTLS#2398)
Browse files Browse the repository at this point in the history
Closes XTLS#2399
  • Loading branch information
flowerinsnowdh authored Aug 6, 2023
1 parent ce89b5d commit 017b56a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func GetFormatByExtension(ext string) string {
return "yaml"
case "toml":
return "toml"
case "json":
case "json", "jsonc":
return "json"
default:
return ""
Expand Down
4 changes: 2 additions & 2 deletions main/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ func dirExists(file string) bool {
func getRegepxByFormat() string {
switch strings.ToLower(*format) {
case "json":
return `^.+\.json$`
return `^.+\.(json|jsonc)$`
case "toml":
return `^.+\.toml$`
case "yaml", "yml":
return `^.+\.(yaml|yml)$`
default:
return `^.+\.(json|toml|yaml|yml)$`
return `^.+\.(json|jsonc|toml|yaml|yml)$`
}
}

Expand Down

0 comments on commit 017b56a

Please sign in to comment.