mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-11 16:24:11 +01:00
Go: Replace strings.Split() with strings.SplitSeq() #5337
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -67,10 +67,8 @@ func (b ExtList) Set(extensions string) {
|
||||
return
|
||||
}
|
||||
|
||||
ext := strings.Split(extensions, ",")
|
||||
|
||||
for i := range ext {
|
||||
b.Add(ext[i])
|
||||
for ext := range strings.SplitSeq(extensions, ",") {
|
||||
b.Add(ext)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 "", ""
|
||||
|
||||
@@ -14,10 +14,9 @@ func Title(s string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
blocks := strings.Split(s, "/")
|
||||
result := make([]string, 0, len(blocks))
|
||||
result := make([]string, 0, 4)
|
||||
|
||||
for _, block := range blocks {
|
||||
for block := range strings.SplitSeq(s, "/") {
|
||||
words := strings.Fields(block)
|
||||
|
||||
if len(words) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user