Skip to content

fix: replacing .png inside the component params#493

Merged
harlan-zw merged 1 commit intonuxt-modules:mainfrom
ThibaudDauce:fix_png_in_params
Mar 10, 2026
Merged

fix: replacing .png inside the component params#493
harlan-zw merged 1 commit intonuxt-modules:mainfrom
ThibaudDauce:fix_png_in_params

Conversation

@ThibaudDauce
Copy link
Contributor

❓ 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

context.ts uses String.replace() to strip the output format extension (.png, .html, etc.) from the URL path before parsing encoded params. String.replace() only replaces the first occurrence, so when a prop value contains the same extension as the output format (e.g. orgLogo=https://example.com/logo.png with a .png output), the extension inside the prop value gets stripped instead of the trailing one.

This results in broken prop values (e.g. logo.png becomes logo) and corrupted downstream params.

Fix: Replace String.replace() with a regex anchored to the end of the string ($), matching the approach already used in urlEncoding.ts's parseOgImageUrl().

@harlan-zw harlan-zw merged commit 053c5e8 into nuxt-modules:main Mar 10, 2026
1 check passed
@harlan-zw
Copy link
Collaborator

Great catch, thank you ☺️

@ThibaudDauce ThibaudDauce deleted the fix_png_in_params branch March 10, 2026 08:01
@ThibaudDauce
Copy link
Contributor Author

Thanks for the quick merge! When do you think you'll release these changes? :-)

@harlan-zw
Copy link
Collaborator

It's out now :)

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