From a2f16bddfd7dfba207c5feaaf472913c38dc3e25 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 10 Sep 2023 18:39:13 +0300 Subject: [PATCH] Preserve the protocol in Series Image --- frontend/src/Series/SeriesImage.js | 8 +++----- package.json | 1 + yarn.lock | 7 +++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend/src/Series/SeriesImage.js b/frontend/src/Series/SeriesImage.js index fddc158b8..b1bd738de 100644 --- a/frontend/src/Series/SeriesImage.js +++ b/frontend/src/Series/SeriesImage.js @@ -7,12 +7,10 @@ function findImage(images, coverType) { } function getUrl(image, coverType, size) { - if (image) { - // Remove protocol - let url = image.url.replace(/^https?:/, ''); - url = url.replace(`${coverType}.jpg`, `${coverType}-${size}.jpg`); + const imageUrl = image?.url; - return url; + if (imageUrl) { + return imageUrl.replace(`${coverType}.jpg`, `${coverType}-${size}.jpg`); } } diff --git a/package.json b/package.json index c09c4e1b7..a3ad4b517 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "@babel/preset-typescript": "7.22.11", "@types/classnames": "2.3.1", "@types/lodash": "4.14.194", + "@types/react-lazyload": "3.2.0", "@types/react-router-dom": "5.3.3", "@types/react-text-truncate": "0.14.1", "@types/react-window": "1.8.5", diff --git a/yarn.lock b/yarn.lock index c209a992e..3f761abd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1443,6 +1443,13 @@ dependencies: "@types/react" "*" +"@types/react-lazyload@3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@types/react-lazyload/-/react-lazyload-3.2.0.tgz#b763f8f0c724df2c969d7e0b3a56c6aa2720fa1f" + integrity sha512-4+r+z8Cf7L/mgxA1vl5uHx5GS/8gY2jqq2p5r5WCm+nUsg9KilwQ+8uaJA3EUlLj57AOzOfGGwwRJ5LOVl8fwA== + dependencies: + "@types/react" "*" + "@types/react-redux@^7.1.16": version "7.1.26" resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.26.tgz#84149f5614e40274bb70fcbe8f7cae6267d548b1"