Simplify name matching code

This commit is contained in:
WithoutPants 2026-03-23 16:13:04 +11:00
parent a690d0aa3f
commit 6f61de3dbb

View file

@ -637,16 +637,12 @@ func (t *stashBoxBatchTagTagTask) findStashBoxTag(ctx context.Context) (*models.
// QueryTag returns tags that partially match the name, so find the exact match if searching by name
if nameQuery != "" {
var exactMatch *models.ScrapedTag
for _, result := range results {
if strings.EqualFold(result.Name, nameQuery) {
exactMatch = result
for _, r := range results {
if strings.EqualFold(r.Name, nameQuery) {
result = r
break
}
}
if exactMatch != nil {
result = exactMatch
}
} else {
result = results[0]
}