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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ext := strings.Split(extensions, ",")
|
for ext := range strings.SplitSeq(extensions, ",") {
|
||||||
|
b.Add(ext)
|
||||||
for i := range ext {
|
|
||||||
b.Add(ext[i])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ func IsDomain(d string) bool {
|
|||||||
if IsLocalSuffix(d) {
|
if IsLocalSuffix(d) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
parts := strings.Split(d, ".")
|
for p := range strings.SplitSeq(d, ".") {
|
||||||
for _, p := range parts {
|
|
||||||
if !IsLabel(p) {
|
if !IsLabel(p) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ func Authorization(c *gin.Context) (authType, authToken string) {
|
|||||||
return "", ""
|
return "", ""
|
||||||
} else if s := c.GetHeader(Auth); s == "" {
|
} else if s := c.GetHeader(Auth); s == "" {
|
||||||
// Ignore.
|
// Ignore.
|
||||||
} else if t := strings.Split(s, " "); len(t) != 2 {
|
} else if typ, token, ok := strings.Cut(s, " "); !ok {
|
||||||
// Ignore.
|
// Ignore.
|
||||||
} else {
|
} else {
|
||||||
return ID(t[0]), ID(t[1])
|
return ID(typ), ID(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", ""
|
return "", ""
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ func Title(s string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks := strings.Split(s, "/")
|
result := make([]string, 0, 4)
|
||||||
result := make([]string, 0, len(blocks))
|
|
||||||
|
|
||||||
for _, block := range blocks {
|
for block := range strings.SplitSeq(s, "/") {
|
||||||
words := strings.Fields(block)
|
words := strings.Fields(block)
|
||||||
|
|
||||||
if len(words) == 0 {
|
if len(words) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user