From 9a9eeae9e5d4c3e66236e2d5a0cb0e7b7f9bff7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Fern=C3=A1ndez?= Date: Mon, 27 Jan 2025 19:27:44 +0100 Subject: [PATCH] fix(images): not always returning logos in getLogo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fernando Fernández --- frontend/src/utils/images.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/src/utils/images.ts b/frontend/src/utils/images.ts index 388e56c12dd..2bd054338f2 100644 --- a/frontend/src/utils/images.ts +++ b/frontend/src/utils/images.ts @@ -445,29 +445,28 @@ export function getLogo( tag?: string; } = {} ): ImageUrlInfo { - let imgType; + const imgType = ImageType.Logo; let imgTag; let itemId: string | null | undefined = item.Id; if (tag) { - imgType = ImageType.Logo; imgTag = tag; } else if (item.ImageTags?.Logo) { - imgType = ImageType.Logo; imgTag = item.ImageTags.Logo; } else if (item.ParentLogoImageTag && item.ParentLogoItemId) { - imgType = ImageType.Logo; imgTag = item.ParentLogoImageTag; itemId = item.ParentLogoItemId; } return { - url: getImageUrlWithSize(itemId ?? '', { - width, - quality, - ratio - }, imgType), + url: isNil(imgTag) + ? undefined + : getImageUrlWithSize(itemId ?? '', { + width, + quality, + ratio + }, imgType), blurhash: - imgType && imgTag ? item.ImageBlurHashes?.[imgType]?.[imgTag] : undefined + imgTag ? item.ImageBlurHashes?.[imgType]?.[imgTag] : undefined }; }