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: correct handling of collapsing slashes #13130

Merged
merged 1 commit into from
Feb 4, 2025
Merged

fix: correct handling of collapsing slashes #13130

merged 1 commit into from
Feb 4, 2025

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Feb 3, 2025

Changes

Multiple trailing slashes are supposed to be collapsed before applying trailing slash rules. However a regex mistake meant that it was also matching duplicate slashes that weren't trailing. This would have been a minor problem, except that in dev is was incorrectly matching against the full URL including query params, not just the path. This meant that duplicate slashes were collapsed in query params too, which is a problem when you might have https://.

This PR fixes both issues: corrects the traailing slash helper to only match trailing slashes, and ensures that the dev matching is applied to the pathname without query params

Testing

Adds a lot of tests for both dev and SSR to cover these.

Fixes #13127

Docs

Copy link

changeset-bot bot commented Feb 3, 2025

🦋 Changeset detected

Latest commit: 281ca00

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

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Feb 3, 2025
Copy link

codspeed-hq bot commented Feb 3, 2025

CodSpeed Performance Report

Merging #13130 will not alter performance

Comparing double-slash (281ca00) with main (2a85bd7)

Summary

✅ 6 untouched benchmarks

@ascorbic ascorbic merged commit b71bd10 into main Feb 4, 2025
17 checks passed
@ascorbic ascorbic deleted the double-slash branch February 4, 2025 09:44
@astrobot-houston astrobot-houston mentioned this pull request Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Astro 5.2.x will remove the trailing slash in the request parameters
2 participants