Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Apr 26, 2024

Trivial follow-up after #29904 (comment)

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 26, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK laanwj, stickies-v, fjahr, Sjors

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label Apr 26, 2024
@maflcko maflcko requested a review from fjahr April 26, 2024 06:35
@laanwj
Copy link
Member

laanwj commented Apr 26, 2024

Code review ACK fa55972

Copy link
Contributor

@stickies-v stickies-v left a comment

Choose a reason for hiding this comment

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

ACK fa55972

@fjahr
Copy link
Contributor

fjahr commented Apr 26, 2024

ACK fa55972

super-mini-nit: In the commit message, urlDecode is now UrlDecode

Copy link
Member

@Sjors Sjors left a comment

Choose a reason for hiding this comment

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

utACK fa55972

@@ -54,6 +54,9 @@ BOOST_AUTO_TEST_CASE(decode_malformed_test) {
BOOST_CHECK_EQUAL(UrlDecode(" %Z "), " %Z ");
BOOST_CHECK_EQUAL(UrlDecode(" % X"), " % X");

BOOST_CHECK_EQUAL(UrlDecode("%%ffg"), "%\xffg");
Copy link
Member

@Sjors Sjors Apr 26, 2024

Choose a reason for hiding this comment

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

I had to scratch my head on this one...

It iterates from left to right, the first thing it finds is %. It then tries if the next two characters are hex, which they are not, so it puts the literal % in the result. Then it moves to the next % which is followed by valid hex ff. Since 0xff is invalid unicode, we have to represent it with the escape sequence "\xff". And then there's the regular character g.

@fanquake fanquake merged commit 7973a67 into bitcoin:master Apr 26, 2024
@maflcko maflcko deleted the 2404-test-urlDec- branch April 26, 2024 08:50
@bitcoin bitcoin locked and limited conversation to collaborators Apr 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants