Skip to content

Commit

Permalink
fix: escape content module import paths (#12705)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic authored Dec 10, 2024
1 parent 70cbd47 commit 0d1eab5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/blue-spiders-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a bug where MDX files with certain characters in the name would cause builds to fail
2 changes: 1 addition & 1 deletion packages/astro/src/content/mutable-data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default new Map([${exports.join(', ')}]);
// We then export them all, mapped by the import id, so we can find them again in the build.
const lines: Array<string> = [];
for (const [fileName, specifier] of this.#moduleImports) {
lines.push(`['${fileName}', () => import('${specifier}')]`);
lines.push(`[${JSON.stringify(fileName)}, () => import(${JSON.stringify(specifier)})]`);
}
const code = `
export default new Map([\n${lines.join(',\n')}]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: I'm back!
description: 'Introduction to Iguana.'
publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)'
tags: [cats, felines]
---

import H2 from "../src/components/H2.astro";

<H2>Iguana</H2>

### Iguana

This is a rendered entry

![file](./I'm%20back.jpg)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0d1eab5

Please sign in to comment.