diff --git a/.changeset/eleven-mugs-flash.md b/.changeset/eleven-mugs-flash.md new file mode 100644 index 000000000..e733a9ff0 --- /dev/null +++ b/.changeset/eleven-mugs-flash.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': patch +--- + +Handle missing trailing slash in processStaticImage diff --git a/packages/integrations/image/src/build/ssg.ts b/packages/integrations/image/src/build/ssg.ts index 076144282..bf0f7460b 100644 --- a/packages/integrations/image/src/build/ssg.ts +++ b/packages/integrations/image/src/build/ssg.ts @@ -138,7 +138,7 @@ export async function ssgBuild({ // Vite will prefix a hashed image with the base path, we need to strip this // off to find the actual file relative to /dist if (config.base && src.startsWith(config.base)) { - src = src.substring(config.base.length - 1); + src = src.substring(config.base.length - +config.base.endsWith('/')); } if (isRemoteImage(src)) {