1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

AK+LibWeb: Encode ' ' as '+' in application/x-www-form-urlencoded

This matches what the URL and HTML specifications ask us to do.
This commit is contained in:
Andreas Kling 2022-04-09 18:34:49 +02:00
parent 74241527d7
commit 3724ce765e
3 changed files with 12 additions and 5 deletions

View file

@ -16,9 +16,9 @@ String url_encode(Vector<QueryParam> const& pairs, AK::URL::PercentEncodeSet per
{
StringBuilder builder;
for (size_t i = 0; i < pairs.size(); ++i) {
builder.append(AK::URL::percent_encode(pairs[i].name, percent_encode_set));
builder.append(AK::URL::percent_encode(pairs[i].name, percent_encode_set, AK::URL::SpaceAsPlus::Yes));
builder.append('=');
builder.append(AK::URL::percent_encode(pairs[i].value, percent_encode_set));
builder.append(AK::URL::percent_encode(pairs[i].value, percent_encode_set, AK::URL::SpaceAsPlus::Yes));
if (i != pairs.size() - 1)
builder.append('&');
}