Skip to content

Commit 9a9eeae

Browse files
committed
fix(images): not always returning logos in getLogo
Signed-off-by: Fernando Fernández <[email protected]>
1 parent 6c48bed commit 9a9eeae

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

frontend/src/utils/images.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,29 +445,28 @@ export function getLogo(
445445
tag?: string;
446446
} = {}
447447
): ImageUrlInfo {
448-
let imgType;
448+
const imgType = ImageType.Logo;
449449
let imgTag;
450450
let itemId: string | null | undefined = item.Id;
451451

452452
if (tag) {
453-
imgType = ImageType.Logo;
454453
imgTag = tag;
455454
} else if (item.ImageTags?.Logo) {
456-
imgType = ImageType.Logo;
457455
imgTag = item.ImageTags.Logo;
458456
} else if (item.ParentLogoImageTag && item.ParentLogoItemId) {
459-
imgType = ImageType.Logo;
460457
imgTag = item.ParentLogoImageTag;
461458
itemId = item.ParentLogoItemId;
462459
}
463460

464461
return {
465-
url: getImageUrlWithSize(itemId ?? '', {
466-
width,
467-
quality,
468-
ratio
469-
}, imgType),
462+
url: isNil(imgTag)
463+
? undefined
464+
: getImageUrlWithSize(itemId ?? '', {
465+
width,
466+
quality,
467+
ratio
468+
}, imgType),
470469
blurhash:
471-
imgType && imgTag ? item.ImageBlurHashes?.[imgType]?.[imgTag] : undefined
470+
imgTag ? item.ImageBlurHashes?.[imgType]?.[imgTag] : undefined
472471
};
473472
}

0 commit comments

Comments
 (0)