mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-27 05:22:51 +00:00
LibWeb: Replace "+" in value with a space while decoding search params
This commit is contained in:
parent
9c72fc9642
commit
d38b28b57b
Notes:
github-actions[bot]
2024-08-10 08:47:17 +00:00
Author: https://github.com/shannonbooth 🔰
Commit: d38b28b57b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1023
Reviewed-by: https://github.com/awesomekling
3 changed files with 14 additions and 1 deletions
|
@ -113,10 +113,11 @@ ErrorOr<Vector<QueryParam>> url_decode(StringView input)
|
|||
|
||||
// 4. Replace any 0x2B (+) in name and value with 0x20 (SP).
|
||||
auto space_decoded_name = name.replace("+"sv, " "sv, ReplaceMode::All);
|
||||
auto space_decoded_value = value.replace("+"sv, " "sv, ReplaceMode::All);
|
||||
|
||||
// 5. Let nameString and valueString be the result of running UTF-8 decode without BOM on the percent-decoding of name and value, respectively.
|
||||
auto name_string = String::from_utf8_with_replacement_character(URL::percent_decode(space_decoded_name));
|
||||
auto value_string = String::from_utf8_with_replacement_character(URL::percent_decode(value));
|
||||
auto value_string = String::from_utf8_with_replacement_character(URL::percent_decode(space_decoded_value));
|
||||
|
||||
TRY(output.try_empend(move(name_string), move(value_string)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue