mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 20:30:51 +08:00
fix(auth): normalize plan type filenames to lowercase
This commit is contained in:
@@ -4,9 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"golang.org/x/text/cases"
|
|
||||||
"golang.org/x/text/language"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CredentialFileName returns the filename used to persist Codex OAuth credentials.
|
// CredentialFileName returns the filename used to persist Codex OAuth credentials.
|
||||||
@@ -43,15 +40,7 @@ func normalizePlanTypeForFilename(planType string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, part := range parts {
|
for i, part := range parts {
|
||||||
parts[i] = titleToken(part)
|
parts[i] = strings.ToLower(strings.TrimSpace(part))
|
||||||
}
|
}
|
||||||
return strings.Join(parts, "-")
|
return strings.Join(parts, "-")
|
||||||
}
|
}
|
||||||
|
|
||||||
func titleToken(token string) string {
|
|
||||||
token = strings.TrimSpace(token)
|
|
||||||
if token == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return cases.Title(language.English).String(token)
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user