Fix image optimizacion on /public #473

This commit is contained in:
prototypa
2024-06-22 12:30:34 -04:00
parent ac0fc0ae83
commit b2632ee3b1

View File

@@ -41,12 +41,15 @@ const _image = await findImage(props.src);
let image: ImageType | undefined = undefined; let image: ImageType | undefined = undefined;
if ( if (typeof _image === 'string') {
typeof _image === 'string' && if ((_image.startsWith('http://') || _image.startsWith('https://')) && isUnpicCompatible(_image)) {
(_image.startsWith('http://') || _image.startsWith('https://')) && image = await getImagesOptimized(_image, props, unpicOptimizer);
isUnpicCompatible(_image) } else {
) { image = {
image = await getImagesOptimized(_image, props, unpicOptimizer); src: _image,
attributes: { ...props, src: undefined },
};
}
} else if (_image) { } else if (_image) {
image = await getImagesOptimized(_image, props, astroAsseetsOptimizer); image = await getImagesOptimized(_image, props, astroAsseetsOptimizer);
} }