Fix error when creating/updating performer with alias == name (#4443)

* Filter out performer aliases that match the name
* Validate when creating/updating performer in stash-box task
This commit is contained in:
WithoutPants
2024-01-09 14:57:49 +11:00
committed by GitHub
parent ca976a0994
commit 6271f18979
2 changed files with 16 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/scraper"
"github.com/stashapp/stash/pkg/scraper/stashbox/graphql"
"github.com/stashapp/stash/pkg/sliceutil"
"github.com/stashapp/stash/pkg/sliceutil/stringslice"
"github.com/stashapp/stash/pkg/txn"
"github.com/stashapp/stash/pkg/utils"
@@ -669,6 +670,12 @@ func performerFragmentToScrapedPerformer(p graphql.PerformerFragment) *models.Sc
}
if len(p.Aliases) > 0 {
// #4437 - stash-box may return aliases that are equal to the performer name
// filter these out
p.Aliases = sliceutil.Filter(p.Aliases, func(s string) bool {
return !strings.EqualFold(s, p.Name)
})
alias := strings.Join(p.Aliases, ", ")
sp.Aliases = &alias
}