From a7b37e30e419bd50d446aa2e81e4d93c86f8789c Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 23 Dec 2024 12:17:32 +0000 Subject: [PATCH] fix: injected route entrypoint --- .changeset/sour-bananas-rule.md | 7 +++++++ packages/astro/src/core/util.ts | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/sour-bananas-rule.md diff --git a/.changeset/sour-bananas-rule.md b/.changeset/sour-bananas-rule.md new file mode 100644 index 0000000000..7e8af13d68 --- /dev/null +++ b/.changeset/sour-bananas-rule.md @@ -0,0 +1,7 @@ +--- +'astro': patch +--- + +Fixes an issue where an injected route entrypoint wasn't correctly marked because the resolved file path contained a query parameter. + +This fixes some edge case where some injected entrypoint were not resolved when using an adapter. diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index f0447529a9..dd663de839 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -115,7 +115,11 @@ function isInPagesDir(file: URL, config: AstroConfig): boolean { function isInjectedRoute(file: URL, settings: AstroSettings) { let fileURL = file.toString(); for (const route of settings.resolvedInjectedRoutes) { - if (route.resolvedEntryPoint && fileURL === route.resolvedEntryPoint.toString()) return true; + if ( + route.resolvedEntryPoint && + removeQueryString(fileURL) === removeQueryString(route.resolvedEntryPoint.toString()) + ) + return true; } return false; }