From 3a740290359e0f669d4b705fb269d073ad828211 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 18 Sep 2023 17:49:26 +0300 Subject: [PATCH] Preserve the protocol in Artist Image Closes #4141 --- frontend/src/Artist/ArtistImage.js | 9 +++------ frontend/src/Artist/ArtistLogo.js | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/frontend/src/Artist/ArtistImage.js b/frontend/src/Artist/ArtistImage.js index 6ebb48fe3..669cba8d8 100644 --- a/frontend/src/Artist/ArtistImage.js +++ b/frontend/src/Artist/ArtistImage.js @@ -7,13 +7,10 @@ function findImage(images, coverType) { } function getUrl(image, coverType, size) { - if (image) { - // Remove protocol - let url = image.url.replace(/^https?:/, ''); + const imageUrl = image?.url; - url = url.replace(`${coverType}.jpg`, `${coverType}-${size}.jpg`); - - return url; + if (imageUrl) { + return imageUrl.replace(`${coverType}.jpg`, `${coverType}-${size}.jpg`); } } diff --git a/frontend/src/Artist/ArtistLogo.js b/frontend/src/Artist/ArtistLogo.js index 10358625f..93b91c2da 100644 --- a/frontend/src/Artist/ArtistLogo.js +++ b/frontend/src/Artist/ArtistLogo.js @@ -10,12 +10,10 @@ function findLogo(images) { } function getLogoUrl(logo, size) { - if (logo) { - // Remove protocol - let url = logo.url.replace(/^https?:/, ''); - url = url.replace('logo.jpg', `logo-${size}.jpg`); + const logoUrl = logo?.url; - return url; + if (logoUrl) { + return logoUrl.replace('logo.jpg', `logo-${size}.jpg`); } }