Repository navigation
Fix trailing slash handling for dynamic file endpoints in dev mode - #17224
Merged
Merged
Conversation
…17001)\n\ntrailingSlashForPath used pathname (null for dynamic routes) to check\nfor file extensions, causing dynamic file endpoints like [name].json.ts\nto inherit trailingSlash: 'always' instead of forcing 'never'. Use the\nroute string from joinSegments as a fallback, which preserves file\nextensions even for dynamic segments.
1 task
🦋 Changeset detectedLatest commit: 48d17b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 393 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ematipico
approved these changes
Jun 29, 2026
1 task
ChBrain
added a commit
to ChBrain/khai-website
that referenced
this pull request
Jul 3, 2026
#452) Dependabot's astro 7.0.3 -> 7.0.6 bump (#449) fails the build job: `astro build` throws `TypeError: Missing parameter: <param>` while prerendering the dynamic file endpoint src/pages/plays/[house]/search-index.json.ts. Root cause is upstream, not our code. Bisected clean (7.0.3 builds, 7.0.4 fails) and reproduced with a minimal public-only Astro project, so it is a regression from withastro/astro#17224 ("trailing slash handling for dynamic file endpoints") interacting with our `trailingSlash: "always"` config. No fixed release exists yet (npm latest = 7.0.6). Add an explicit-version ignore for astro 7.0.4/7.0.5/7.0.6 so Dependabot stops re-proposing the broken bump. Listing exact versions (not a range) lets a patched 7.0.7+/7.1.x through, so Dependabot re-proposes once upstream ships a fix; drop this entry then. Co-authored-by: Claude <[email protected]>
dadezzz
pushed a commit
to dadezzz/university_notes
that referenced
this pull request
Jul 4, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`7.0.3` → `7.0.4`](https://renovatebot.com/diffs/npm/astro/7.0.3/7.0.4) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v7.0.4`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#704) [Compare Source](https://github.com/withastro/astro/compare/[email protected]@7.0.4) ##### Patch Changes - [#​17212](withastro/astro#17212) [`7ba0bb1`](withastro/astro@7ba0bb1) Thanks [@​matthewp](https://github.com/matthewp)! - Ensures transition directive values are HTML-escaped when rendered on hydrated islands - [#​17224](withastro/astro#17224) [`dc5e52f`](withastro/astro@dc5e52f) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes trailing slash handling for dynamic file endpoints in dev mode. Dynamic file endpoints (e.g., `src/pages/api/[name].json.ts`) with `trailingSlash: "always"` incorrectly required a trailing slash in dev mode, returning 404 for `/api/bar.json` and 200 for `/api/bar.json/`. - [#​17067](withastro/astro#17067) [`23f9446`](withastro/astro@23f9446) Thanks [@​fkatsuhiro](https://github.com/fkatsuhiro)! - Fixed a bug where the development toolbar did not output a warning even though the implicit ARIA role and the manually specified role were duplicated. - [#​17234](withastro/astro#17234) [`d5fbee8`](withastro/astro@d5fbee8) Thanks [@​ocavue](https://github.com/ocavue)! - Adds support for [`sharp` v0.35](https://github.com/lovell/sharp/releases/tag/v0.35.0). pnpm users no longer need to approve `sharp`'s build script (see [`allowBuilds`](https://pnpm.io/settings#allowbuilds)) when on v0.35. - [#​17223](withastro/astro#17223) [`5970ef4`](withastro/astro@5970ef4) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes `getCollection()` returning empty in dev mode for large content collections (500k+ entries) - [#​17184](withastro/astro#17184) [`799e5cd`](withastro/astro@799e5cd) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Upgrades the Rust compiler to the latest, which fixes some bugs. Refer to its [changelog](https://github.com/withastro/compiler-rs/releases/tag/%40astrojs%2Fcompiler-rs%400.3.0) for more information. - [#​17208](withastro/astro#17208) [`da8b573`](withastro/astro@da8b573) Thanks [@​matthewp](https://github.com/matthewp)! - Hardens forwarded header handling so the internal request helper validates `X-Forwarded-Host` against `security.allowedDomains` before trusting `X-Forwarded-For` for `clientAddress`. Previously it only checked that the header was present, which was inconsistent with the public `createRequest` helper. This aligns both code paths; behavior is unchanged for correctly configured proxies. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDYuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI0Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
src/pages/api/[name].json.tswithtrailingSlash: "always"now correctly return 200 for/api/bar.jsonand 404 for/api/bar.json/in dev mode, matching production behavior and the documented Astro v6 rule that file endpoints are never served with a trailing slash.trailingSlashForPathcheckedpathname && hasFileExtension(pathname), butpathnameisnullfor dynamic routes (any segment with a param). The fix adds an optionalroutefallback parameter — the string fromjoinSegments— which preserves file extensions even for dynamic segments (e.g.,/api/[name].json), allowing the file-extension check to work correctly.Testing
'dynamic file endpoints force trailingSlash never. issues#17001'inpackages/astro/test/units/routing/manifest.test.ts: creates a[name].json.tspage undertrailingSlash: "always"and asserts the generated route pattern matches without a trailing slash and rejects with one.Docs
Closes #17001