Skip to content

fix: use JSON.stringify in onBadUrl for proper escaping#6420

Merged
mcollina merged 1 commit intomainfrom
fix-onbadurl-json-stringify
Dec 23, 2025
Merged

fix: use JSON.stringify in onBadUrl for proper escaping#6420
mcollina merged 1 commit intomainfrom
fix-onbadurl-json-stringify

Conversation

@mcollina
Copy link
Member

Summary

  • Use JSON.stringify to properly escape special characters in the bad URL path instead of template string interpolation
  • Use Buffer.byteLength for accurate Content-Length calculation with multi-byte characters
  • Add test case to verify JSON escaping works correctly

Test plan

  • Added test case for bad URL with special characters that need JSON escaping
  • Existing tests pass

Use JSON.stringify to properly escape special characters in the bad URL
path instead of template string interpolation. Also use Buffer.byteLength
for accurate Content-Length calculation with multi-byte characters.
@mcollina mcollina requested review from Eomm and jsumners December 23, 2025 08:05
Copy link
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

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

Oha!

@mcollina mcollina merged commit 79ab8e9 into main Dec 23, 2025
33 checks passed
@mcollina mcollina deleted the fix-onbadurl-json-stringify branch December 23, 2025 18:21
@Eomm Eomm added the bugfix Issue or PR that should land as semver patch label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Issue or PR that should land as semver patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants