Skip to content

Fix: Correctly decode Unicode escape sequences in JsonDecode#560

Merged
dnzbk merged 1 commit intonzbgetcom:developfrom
Darshan-H-E:bugfix/json-decode-unicode-escape
May 2, 2025
Merged

Fix: Correctly decode Unicode escape sequences in JsonDecode#560
dnzbk merged 1 commit intonzbgetcom:developfrom
Darshan-H-E:bugfix/json-decode-unicode-escape

Conversation

@Darshan-H-E
Copy link
Copy Markdown
Contributor

Description

The JsonDecode function in WebUtil incorrectly handled Unicode escape sequences like \u0026. This could lead to malformed data when decoding JSON, particularly URLs containing ampersands passed via the API.

This commit modifies the JsonDecode logic to correctly parse \uXXXX sequences into their corresponding characters using strtoul.

Lib changes

NA

Testing

Unit tests have been added in JsonDecodeTest to verify the fix and cover various standard and Unicode escape sequence scenarios.

The JsonDecode function in WebUtil incorrectly handled Unicode escape
sequences like \u0026. This could lead to malformed data when decoding
JSON, particularly URLs containing ampersands passed via the API.

This commit modifies the JsonDecode logic to correctly parse \uXXXX
sequences into their corresponding characters using strtoul.

Unit tests have been added in JsonDecodeTest to verify the fix and cover
various standard and Unicode escape sequence scenarios.
Copy link
Copy Markdown
Collaborator

@dnzbk dnzbk left a comment

Choose a reason for hiding this comment

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

Thank you!

@dnzbk dnzbk linked an issue May 2, 2025 that may be closed by this pull request
1 task
@dnzbk dnzbk merged commit 170b00e into nzbgetcom:develop May 2, 2025
9 checks passed
@dnzbk dnzbk mentioned this pull request May 12, 2025
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.

\u0026 is replaced by j in URL when adding nzb through API

2 participants