mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Fix inconsistency when scraping performer with multiple stash ids from same endpoint (#6260)
This commit is contained in:
parent
d743787bb3
commit
bc91ca0a25
1 changed files with 16 additions and 0 deletions
|
|
@ -146,6 +146,22 @@ export const PerformerScrapeDialog: React.FC<IPerformerScrapeDialogProps> = (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #6257 - it is possible (though unsupported) to have multiple stash IDs for the same
|
||||||
|
// endpoint; in that case, we should prefer the one matching the scraped remote site ID
|
||||||
|
// if it exists
|
||||||
|
const stashIDs = (props.performer.stash_ids ?? []).filter(
|
||||||
|
(s) => s.endpoint === endpoint
|
||||||
|
);
|
||||||
|
if (stashIDs.length > 1 && props.scraped.remote_site_id) {
|
||||||
|
const matchingID = stashIDs.find(
|
||||||
|
(s) => s.stash_id === props.scraped.remote_site_id
|
||||||
|
);
|
||||||
|
if (matchingID) {
|
||||||
|
return matchingID.stash_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise, return the first stash ID for the endpoint
|
||||||
return props.performer.stash_ids?.find((s) => s.endpoint === endpoint)
|
return props.performer.stash_ids?.find((s) => s.endpoint === endpoint)
|
||||||
?.stash_id;
|
?.stash_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue