From ed2b5ff1d7766eaff53261ec6a9012fa10f1f31b Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 20 Jul 2021 01:33:11 +0800 Subject: [PATCH] Avoid extra redirect with spee.ch images I'm not sure what's the history behind splitting the logic between speech and non-speech, but currently, doing `${thumbnail}?quality=${quality}&height=${height}&width=${width}` will result in a redirect to `${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:80/plain/${thumbnail}` (hardcoded to 80). That's the same CDN url we use for non-speech, so might as do the same for all images to avoid the redirect. --- ui/util/thumbnail.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui/util/thumbnail.js b/ui/util/thumbnail.js index 3d5c8d73c..15e652d6c 100644 --- a/ui/util/thumbnail.js +++ b/ui/util/thumbnail.js @@ -19,11 +19,7 @@ export function getThumbnailCdnUrl(props: Props) { return thumbnail; } - if (thumbnail && !thumbnail.includes('https://spee.ch')) { + if (thumbnail) { return `${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:${quality}/plain/${thumbnail}`; } - - if (thumbnail && thumbnail.includes('https://spee.ch')) { - return `${thumbnail}?quality=${quality}&height=${height}&width=${width}`; - } }