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

fix: strip internal data before passing URL to reroute #13092

Merged
merged 11 commits into from
Jan 17, 2025

Conversation

eltigerchino
Copy link
Member

@eltigerchino eltigerchino commented Dec 2, 2024

fixes #11625

This PR ensures that the /__data.json suffix, x-sveltekit-trailing-slash, and x-sveltekit-invalidated query param are stripped before passing a copy of the URL to reroute so that the URL can be correctly rerouted instead of causing a 404 due to the /__data.json pathname suffix.

If this PR gets merged, we will need a shared solution for the edge middlewares running reroute in #12296


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: /~https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Dec 2, 2024

🦋 Changeset detected

Latest commit: bcecf13

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@eltigerchino eltigerchino marked this pull request as draft December 2, 2024 03:14
@eltigerchino eltigerchino marked this pull request as ready for review December 2, 2024 05:44
@dummdidumm
Copy link
Member

If this PR gets merged, we will need a shared solution for the edge middlewares running reroute in #12296

To clarify: If we merge this, then we need to adjust the referenced PR to also deal with this case, but it's not something that forces our hand in other places?

@eltigerchino
Copy link
Member Author

If this PR gets merged, we will need a shared solution for the edge middlewares running reroute in #12296

To clarify: If we merge this, then we need to adjust the referenced PR to also deal with this case, but it's not something that forces our hand in other places?

We'd probably need to make the same adjustment if we need to run reroute in other places too. For now, it's only the Vercel and Netlify adapters that have to run reroute earlier to route to the correct split function. I don't think there are other adapters that would need the same changes since only Vercel and Netlify have the split option.

@Rich-Harris
Copy link
Member

preview: https://svelte-dev-git-preview-kit-13092-svelte.vercel.app/

this is an automated message

@dummdidumm dummdidumm merged commit 6774ebc into main Jan 17, 2025
13 of 14 checks passed
@dummdidumm dummdidumm deleted the fix-reroute-invalidate branch January 17, 2025 10:37
@github-actions github-actions bot mentioned this pull request Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to fetch /__data.json?x-sveltekit-invalidated on "rerouted" pages in development
3 participants