Allow special characters in filenames (#2091)

#2089
This commit is contained in:
Drew Powers 2021-12-02 10:45:54 -07:00 committed by GitHub
parent 97174e6ff4
commit 0a826c999c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Bugfix: allow special characters in filenames

View file

@ -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(/^\/?/, '/')}`;
}

View file

@ -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 () => {

View file

@ -0,0 +1,5 @@
---
title: Special chars
---
# I have special characters