mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 12:49:20 +02:00
Recognize .jsonc files automatically (#2398)
Closes https://github.com/XTLS/Xray-core/issues/2399
This commit is contained in:
parent
ce89b5d7de
commit
017b56adf5
|
@ -57,7 +57,7 @@ func GetFormatByExtension(ext string) string {
|
||||||
return "yaml"
|
return "yaml"
|
||||||
case "toml":
|
case "toml":
|
||||||
return "toml"
|
return "toml"
|
||||||
case "json":
|
case "json", "jsonc":
|
||||||
return "json"
|
return "json"
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -113,13 +113,13 @@ func dirExists(file string) bool {
|
||||||
func getRegepxByFormat() string {
|
func getRegepxByFormat() string {
|
||||||
switch strings.ToLower(*format) {
|
switch strings.ToLower(*format) {
|
||||||
case "json":
|
case "json":
|
||||||
return `^.+\.json$`
|
return `^.+\.(json|jsonc)$`
|
||||||
case "toml":
|
case "toml":
|
||||||
return `^.+\.toml$`
|
return `^.+\.toml$`
|
||||||
case "yaml", "yml":
|
case "yaml", "yml":
|
||||||
return `^.+\.(yaml|yml)$`
|
return `^.+\.(yaml|yml)$`
|
||||||
default:
|
default:
|
||||||
return `^.+\.(json|toml|yaml|yml)$`
|
return `^.+\.(json|jsonc|toml|yaml|yml)$`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue