Skip to content

Commit

Permalink
fix: Query params trigger the trailingSlash error in preview mode (#9045
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Rishi Raj Jain authored Nov 14, 2023
1 parent b895113 commit 84312f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tidy-peas-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes preview server `trailingSlash` handling for request URLs with query strings
3 changes: 2 additions & 1 deletion packages/astro/src/core/preview/vite-plugin-astro-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export function vitePluginAstroPreview(settings: AstroSettings): Plugin {
return;
}

const pathname = stripBase(req.url!, base);
const strippedPathname = stripBase(req.url!, base);
const pathname = new URL(strippedPathname, 'https://a.b').pathname
const isRoot = pathname === '/';

// Validate trailingSlash
Expand Down

0 comments on commit 84312f2

Please sign in to comment.