summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorGravatar Drew Powers <1369770+drwpow@users.noreply.github.com> 2021-12-02 10:45:54 -0700
committerGravatar GitHub <noreply@github.com> 2021-12-02 10:45:54 -0700
commit0a826c999c8ee30d5ee2ae61ac4165fb9797da70 (patch)
tree059b63eb26294d6810dbc7a375ac809c5ec80284 /packages
parent97174e6ff4505bf2aa795a3edd5cb66cf36afbe8 (diff)
downloadastro-0a826c999c8ee30d5ee2ae61ac4165fb9797da70.tar.gz
astro-0a826c999c8ee30d5ee2ae61ac4165fb9797da70.tar.zst
astro-0a826c999c8ee30d5ee2ae61ac4165fb9797da70.zip
Allow special characters in filenames (#2091)
#2089
Diffstat (limited to 'packages')
-rw-r--r--packages/astro/src/core/util.ts2
-rw-r--r--packages/astro/test/astro-basic.test.js5
-rw-r--r--packages/astro/test/fixtures/astro-basic/src/pages/special-“characters” -in-file.md5
3 files changed, 11 insertions, 1 deletions
diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts
index e05a76801..df93938bc 100644
--- a/packages/astro/src/core/util.ts
+++ b/packages/astro/src/core/util.ts
@@ -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(/^\/?/, '/')}`;
}
diff --git a/packages/astro/test/astro-basic.test.js b/packages/astro/test/astro-basic.test.js
index 72668820b..fc8c43cca 100644
--- a/packages/astro/test/astro-basic.test.js
+++ b/packages/astro/test/astro-basic.test.js
@@ -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 () => {
diff --git a/packages/astro/test/fixtures/astro-basic/src/pages/special-“characters” -in-file.md b/packages/astro/test/fixtures/astro-basic/src/pages/special-“characters” -in-file.md
new file mode 100644
index 000000000..6a0ec636a
--- /dev/null
+++ b/packages/astro/test/fixtures/astro-basic/src/pages/special-“characters” -in-file.md
@@ -0,0 +1,5 @@
+---
+title: Special chars
+---
+
+# I have special characters