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(nuxt): normalise encoded trailing slashes before redirecting #26994

Closed
wants to merge 4 commits into from

Conversation

danielroe
Copy link
Member

🔗 Linked issue

resolves #26882

📚 Description

This manually normalises encoded trailing slashes before comparing the paths to see if a redirect is required.

Copy link

stackblitz bot commented Apr 29, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment on lines +281 to +284
const ENCODED_TRAILING_SLASH_RE = /%2F$/
function isSamePath (initialURL: string, path: string) {
return withoutTrailingSlash(decode(initialURL).replace(ENCODED_TRAILING_SLASH_RE, '/')) === withoutTrailingSlash(decode(path).replace(ENCODED_TRAILING_SLASH_RE, '/'))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we should consider fixing/handling in ufo too?

Copy link
Member Author

@danielroe danielroe Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought he might not want to make this change, but what do you think @pi0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For path comparation utils? i guess makes sense

@danielroe danielroe deleted the fix/trailing-slash-redirect branch May 9, 2024 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On Vercel, Nuxt v3.11.2 causes infinite redirect when query string contains + is passed
3 participants