Go: Replace strings.Split() with strings.SplitSeq() #5337

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2025-11-25 14:26:29 +01:00
parent 590213572b
commit ebed7fa5b4
4 changed files with 7 additions and 11 deletions

View file

@ -22,8 +22,7 @@ func IsDomain(d string) bool {
if IsLocalSuffix(d) {
return false
}
parts := strings.Split(d, ".")
for _, p := range parts {
for p := range strings.SplitSeq(d, ".") {
if !IsLabel(p) {
return false
}

View file

@ -60,10 +60,10 @@ func Authorization(c *gin.Context) (authType, authToken string) {
return "", ""
} else if s := c.GetHeader(Auth); s == "" {
// Ignore.
} else if t := strings.Split(s, " "); len(t) != 2 {
} else if typ, token, ok := strings.Cut(s, " "); !ok {
// Ignore.
} else {
return ID(t[0]), ID(t[1])
return ID(typ), ID(token)
}
return "", ""