diff options
author | 2022-06-29 14:46:23 +0000 | |
---|---|---|
committer | 2022-06-29 09:46:23 -0500 | |
commit | 54cd6b8dd184fb0acb2facaa9b6843be59f9c57f (patch) | |
tree | f2f33cc18eabb68f57b2c8079dc3f41559e3e4f1 | |
parent | 40be96d7c89137c76831c8944fbd4a442563b9a6 (diff) | |
download | astro-54cd6b8dd184fb0acb2facaa9b6843be59f9c57f.tar.gz astro-54cd6b8dd184fb0acb2facaa9b6843be59f9c57f.tar.zst astro-54cd6b8dd184fb0acb2facaa9b6843be59f9c57f.zip |
Fixes a bug in how `injectRoute` parses route patterns on Windows (#3763)
* always remove a leading slash in the `injectRoute` pattern
* chore: add changeset
-rw-r--r-- | .changeset/seven-rocks-sort.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/routing/manifest/create.ts | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/.changeset/seven-rocks-sort.md b/.changeset/seven-rocks-sort.md new file mode 100644 index 000000000..32b4a25ac --- /dev/null +++ b/.changeset/seven-rocks-sort.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes how `injectRoute` parses route patterns on Windows diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index 053624961..ba40f3b1b 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -7,6 +7,7 @@ import path from 'path'; import slash from 'slash'; import { fileURLToPath } from 'url'; import { warn } from '../../logger/core.js'; +import { removeLeadingForwardSlash } from '../../path.js'; import { resolvePages } from '../../util.js'; import { getRouteGenerator } from './generator.js'; const require = createRequire(import.meta.url); @@ -294,7 +295,7 @@ export function createRouteManifest( const isDynamic = (str: string) => str?.[0] === '['; const normalize = (str: string) => str?.substring(1, str?.length - 1); - const segments = name + const segments = removeLeadingForwardSlash(name) .split(path.sep) .filter(Boolean) .map((s: string) => { |