fixed out of range error on gotify message being sent

This commit is contained in:
yusing 2024-10-22 16:46:12 +08:00
parent bee26f43d4
commit cfa74d69ae

View file

@ -9,9 +9,6 @@ import (
"golang.org/x/text/language" "golang.org/x/text/language"
) )
// TODO: support other languages.
var titleCaser = cases.Title(language.AmericanEnglish)
func CommaSeperatedList(s string) []string { func CommaSeperatedList(s string) []string {
res := strings.Split(s, ",") res := strings.Split(s, ",")
for i, part := range res { for i, part := range res {
@ -21,7 +18,8 @@ func CommaSeperatedList(s string) []string {
} }
func Title(s string) string { func Title(s string) string {
return titleCaser.String(s) // TODO: support other languages.
return cases.Title(language.AmericanEnglish).String(s)
} }
func ExtractPort(fullURL string) (int, error) { func ExtractPort(fullURL string) (int, error) {