0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

fix: Query params trigger the trailingSlash error in preview mode (#9045)

This commit is contained in:
Rishi Raj Jain 2023-11-14 15:09:37 +05:30 committed by GitHub
parent b895113a0a
commit 84312f24f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes preview server `trailingSlash` handling for request URLs with query strings

View file

@ -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