mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
Check for dupe IDs against boxes (#6309)
This commit is contained in:
@@ -79,10 +79,23 @@ func (s StashIDInputs) ToStashIDs() StashIDs {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := make(StashIDs, len(s))
|
// #2800 - deduplicate StashIDs based on endpoint and stash_id
|
||||||
for i, v := range s {
|
ret := make(StashIDs, 0, len(s))
|
||||||
ret[i] = v.ToStashID()
|
seen := make(map[string]map[string]bool)
|
||||||
|
|
||||||
|
for _, v := range s {
|
||||||
|
stashID := v.ToStashID()
|
||||||
|
|
||||||
|
if seen[stashID.Endpoint] == nil {
|
||||||
|
seen[stashID.Endpoint] = make(map[string]bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !seen[stashID.Endpoint][stashID.StashID] {
|
||||||
|
seen[stashID.Endpoint][stashID.StashID] = true
|
||||||
|
ret = append(ret, stashID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user