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: doubly encoding of URLs #390

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Conversation

Mastercuber
Copy link
Contributor

@Mastercuber Mastercuber commented Dec 18, 2024

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

I'm building a blog nuxt app and using the sitemap module. While reading the sitemap, I recognized that the URLs containing umlauts like ä, ö, ü, ß and also á, à etc. are invalid. They get doubly encoded. For example: /Bücher should be encoded to /B%C3%BCcher, but now it is /B%25C3%25BCcher. The latter value is generated, when the first value (/Bücher) get URL encoded twice, so decodeURI(decodeURI('B%25C3%25BCcher')) will lead to /Bücher again.

This PR is addressing this issue, also providing a test, to show that it really only gets encoded once. For this, a little helper function was introduced (isEncoded) to check if a string is already encoded or not.

I didn't add a test showing the issue, only one for the solution..

The failing eslint checks seems unrelated to the changes..

Copy link

vercel bot commented Dec 18, 2024

@Mastercuber is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@harlan-zw
Copy link
Collaborator

Cool, great fix. Thanks!

@harlan-zw harlan-zw changed the title fix: doubly coding of URL fix: doubly encoding of URLs Dec 24, 2024
@harlan-zw harlan-zw merged commit f15e5c8 into nuxt-modules:main Dec 24, 2024
1 of 2 checks passed
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.

2 participants