getImageProxyUrl: don't assume IMAGE_PROXY_URL is always defined

This allows us to disable it by not defining.
This commit is contained in:
infinite-persistence 2022-03-29 21:51:22 +08:00 committed by Thomas Zarebczan
parent b40160a939
commit 0d3f6c2f9e

View file

@ -25,7 +25,12 @@ export function getThumbnailCdnUrl(props: Props) {
}
export function getImageProxyUrl(thumbnail: ?string) {
if (thumbnail && !thumbnail.startsWith(THUMBNAIL_CDN_URL) && !thumbnail.startsWith(IMAGE_PROXY_URL)) {
if (
IMAGE_PROXY_URL &&
thumbnail &&
!thumbnail.startsWith(THUMBNAIL_CDN_URL) &&
!thumbnail.startsWith(IMAGE_PROXY_URL)
) {
return `${IMAGE_PROXY_URL}?${thumbnail}`;
}
return thumbnail;