fix: make some changes

This commit is contained in:
Max Richter
2025-10-21 19:38:33 +02:00
parent 97f9b0cbf7
commit 11795d336e
29 changed files with 222 additions and 45 deletions

View File

@@ -15,13 +15,15 @@ interface Props {
async function checkImage(src: string) {
try {
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return true;
const res = await fetch(src);
if (res.ok) {
return src;
return true;
}
return undefined;
return false;
} catch (err) {
return undefined;
console.log("Failed to fetch: ",src);
return false;
}
}
@@ -35,8 +37,7 @@ const {
} = Astro.props;
let thumbhash = hash && image.fsPath ? await generateThumbHash(image) : "";
const imageSrc = await checkImage(image.src);
const imageOk = await checkImage(image.src);
let exif = await getExifData(image);
@@ -60,9 +61,9 @@ const sizes = [
---
{
imageSrc ? (
imageOk ? (
<AstroImage
src={imageSrc}
src={image}
alt={alt}
data-thumbhash={thumbhash}
data-exif={JSON.stringify(exif)}