diff --git a/.changeset/famous-teachers-hug.md b/.changeset/famous-teachers-hug.md new file mode 100644 index 0000000000..988f2993f9 --- /dev/null +++ b/.changeset/famous-teachers-hug.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix a bug that caused builds to fail if an image had a quote mark in its name diff --git a/packages/astro/src/content/mutable-data-store.ts b/packages/astro/src/content/mutable-data-store.ts index 18a7662ee6..9587b30596 100644 --- a/packages/astro/src/content/mutable-data-store.ts +++ b/packages/astro/src/content/mutable-data-store.ts @@ -102,7 +102,7 @@ export class MutableDataStore extends ImmutableDataStore { const exports: Array = []; this.#assetImports.forEach((id) => { const symbol = importIdToSymbolName(id); - imports.push(`import ${symbol} from '${id}';`); + imports.push(`import ${symbol} from ${JSON.stringify(id)};`); exports.push(`[${JSON.stringify(id)}, ${symbol}]`); }); const code = /* js */ ` diff --git a/packages/astro/test/fixtures/content-layer/images/I'm back.jpg b/packages/astro/test/fixtures/content-layer/images/I'm back.jpg new file mode 100644 index 0000000000..7455a726ef Binary files /dev/null and b/packages/astro/test/fixtures/content-layer/images/I'm back.jpg differ diff --git a/packages/astro/test/fixtures/content-layer/src/content/space/endeavour.md b/packages/astro/test/fixtures/content-layer/src/content/space/endeavour.md index 51d6e8c421..43dfd97a1f 100644 --- a/packages/astro/test/fixtures/content-layer/src/content/space/endeavour.md +++ b/packages/astro/test/fixtures/content-layer/src/content/space/endeavour.md @@ -3,6 +3,8 @@ title: Endeavour description: 'Learn about the Endeavour NASA space shuttle.' publishedDate: 'Sun Jul 11 2021 00:00:00 GMT-0400 (Eastern Daylight Time)' tags: [space, 90s] +heroImage: "@images/I'm back.jpg" + --- **Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Endeavour)