Skip to content

Commit bc91ca0

Browse files
authored
Fix inconsistency when scraping performer with multiple stash ids from same endpoint (#6260)
1 parent d743787 commit bc91ca0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ui/v2.5/src/components/Performers/PerformerDetails/PerformerScrapeDialog.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,22 @@ export const PerformerScrapeDialog: React.FC<IPerformerScrapeDialogProps> = (
146146
return;
147147
}
148148

149+
// #6257 - it is possible (though unsupported) to have multiple stash IDs for the same
150+
// endpoint; in that case, we should prefer the one matching the scraped remote site ID
151+
// if it exists
152+
const stashIDs = (props.performer.stash_ids ?? []).filter(
153+
(s) => s.endpoint === endpoint
154+
);
155+
if (stashIDs.length > 1 && props.scraped.remote_site_id) {
156+
const matchingID = stashIDs.find(
157+
(s) => s.stash_id === props.scraped.remote_site_id
158+
);
159+
if (matchingID) {
160+
return matchingID.stash_id;
161+
}
162+
}
163+
164+
// otherwise, return the first stash ID for the endpoint
149165
return props.performer.stash_ids?.find((s) => s.endpoint === endpoint)
150166
?.stash_id;
151167
}

0 commit comments

Comments
 (0)