From 21830b3d58b06f8f13b9c946facdad531c6e061e Mon Sep 17 00:00:00 2001 From: prototypa Date: Thu, 10 Oct 2024 01:51:32 -0400 Subject: [PATCH] Fix issue #530: Image Optimization for remote Images does not work --- src/components/common/Image.astro | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/components/common/Image.astro b/src/components/common/Image.astro index ada4f27..75ad9ad 100644 --- a/src/components/common/Image.astro +++ b/src/components/common/Image.astro @@ -41,15 +41,12 @@ const _image = await findImage(props.src); let image: ImageType | undefined = undefined; -if (typeof _image === 'string') { - if ((_image.startsWith('http://') || _image.startsWith('https://')) && isUnpicCompatible(_image)) { - image = await getImagesOptimized(_image, props, unpicOptimizer); - } else { - image = { - src: _image, - attributes: { ...props, src: undefined }, - }; - } +if ( + typeof _image === 'string' && + (_image.startsWith('http://') || _image.startsWith('https://')) && + isUnpicCompatible(_image) +) { + image = await getImagesOptimized(_image, props, unpicOptimizer); } else if (_image) { image = await getImagesOptimized(_image, props, astroAsseetsOptimizer); }