Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a bug in how injectRoute parses route patterns on Windows #3763

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-rocks-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes how `injectRoute` parses route patterns on Windows
3 changes: 2 additions & 1 deletion packages/astro/src/core/routing/manifest/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) => {
Expand Down