From 34cea3ca7858c1ed99d4654f113db32fb7ffa915 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Mon, 4 Nov 2024 08:38:36 +0100 Subject: [PATCH] Flip ifs --- components/Image.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/components/Image.tsx b/components/Image.tsx index c5fa290cb..accfdb19b 100644 --- a/components/Image.tsx +++ b/components/Image.tsx @@ -24,16 +24,12 @@ function imageLoader({ quality, src, width }: ImageLoaderProps) { const isAbsoluteUrl = src.startsWith("https://") || src.startsWith("http://") const hasQS = src.indexOf("?") !== -1 - if (isAbsoluteUrl) { - if (isBlockedByFirewall(src)) { - return `${src}${hasQS ? "&" : "?"}w=${width}${quality ? "&q=" + quality : ""}` - } else { - return `https://image-scandic-hotels.netlify.app/.netlify/images?url=${src}&w=${width}${quality ? "&q=" + quality : ""}` - //return `https://img.scandichotels.com/.netlify/images?url=${src}&w=${width}${quality ? "&q=" + quality : ""}` //TODO: use this when Daniel fixed DNS in citrix - } + if (!isAbsoluteUrl || isBlockedByFirewall(src)) { + return `${src}${hasQS ? "&" : "?"}w=${width}${quality ? "&q=" + quality : ""}` } - return `${src}${hasQS ? "&" : "?"}w=${width}${quality ? "&q=" + quality : ""}` + return `https://image-scandic-hotels.netlify.app/.netlify/images?url=${src}&w=${width}${quality ? "&q=" + quality : ""}` + //return `https://img.scandichotels.com/.netlify/images?url=${src}&w=${width}${quality ? "&q=" + quality : ""}` //TODO: use this when Daniel fixed DNS in citrix } // Next/Image adds & instead of ? before the params