Skip to content

Commit

Permalink
refactor: Added an extra check for manualCollectionName to the 'Plex-…
Browse files Browse the repository at this point in the history
… Available in amount of other collections' rule. This fixes a potential nullpointer
  • Loading branch information
jorenn92 committed Jan 28, 2024
1 parent 493a3ea commit 3990fa8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions server/src/modules/rules/getter/plex-getter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,27 @@ export class PlexGetterService {
return item.Label ? item.Label.map((l) => l.tag) : [];
}
case 'collections': {
// fetch metadata because collections in plexLibrary object are wrong
return metadata.Collection
? metadata.Collection.filter(
(el) =>
el.tag.toLowerCase().trim() !==
(ruleGroup?.collection?.manualCollection
(ruleGroup?.collection?.manualCollection &&
ruleGroup?.collection?.manualCollectionName
? ruleGroup.collection.manualCollectionName
: ruleGroup.name
)
.toLowerCase()
.trim(),
).length
: 0;
}
case 'collection_tags': {
return metadata.Collection
? metadata.Collection.filter(
(el) =>
el.tag.toLowerCase().trim() !==
(ruleGroup?.collection?.manualCollection &&
ruleGroup?.collection?.manualCollectionName
? ruleGroup.collection.manualCollectionName
: ruleGroup.name
)
Expand Down

0 comments on commit 3990fa8

Please sign in to comment.