1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:07:46 +00:00

AK: Fix logic error in urldecode() percent-decoding

We also need to append the raw consumed value if *either* of the two
characters after the % isn't a hex digit, not only if *both* aren't.

Fixes #4257.
This commit is contained in:
Linus Groh 2020-11-30 00:28:27 +00:00 committed by Andreas Kling
parent 4c8c149612
commit ba020a5907
2 changed files with 15 additions and 1 deletions

View file

@ -57,7 +57,7 @@ String urldecode(const StringView& input)
builder.append(consume());
continue;
}
if (!is_ascii_hex_digit(peek(1)) && !is_ascii_hex_digit(peek(2))) {
if (!is_ascii_hex_digit(peek(1)) || !is_ascii_hex_digit(peek(2))) {
builder.append(consume());
continue;
}