Skip to content

Commit

Permalink
Allow special characters in filenames (#2091)
Browse files Browse the repository at this point in the history
  • Loading branch information
drwpow committed Dec 2, 2021
1 parent 97174e6 commit 0a826c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/proud-yaks-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Bugfix: allow special characters in filenames
2 changes: 1 addition & 1 deletion packages/astro/src/core/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ export function resolveDependency(dep: string, astroConfig: AstroConfig) {
* Windows: /@fs/C:/Users/astro/code/my-project/src/pages/index.astro
*/
export function viteifyURL(filePath: URL): string {
return `/@fs${filePath.pathname}`;
return `/@fs${slash(fileURLToPath(filePath)).replace(/^\/?/, '/')}`;
}
5 changes: 5 additions & 0 deletions packages/astro/test/astro-basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ describe('Astro basics', () => {
// will be 1 if element rendered correctly
expect($('#one')).to.have.lengthOf(1);
});

it('supports special chars in filename', async () => {
// will have already erred by now, but add test anyway
expect(await fixture.readFile('/special-“characters” -in-file/index.html')).to.be.ok;
});
});

it('Supports void elements whose name is a string (#2062)', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Special chars
---

# I have special characters

0 comments on commit 0a826c9

Please sign in to comment.