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

AK+Everywhere: Replace usages of URLParser::urlencode() and urldecode()

This replaces all occurrences of those functions with the newly
implemented functions URL::percent_encode() and URL::percent_decode().
The old functions will be removed in a further commit.
This commit is contained in:
Max Wipfli 2021-05-25 14:06:03 +02:00 committed by Andreas Kling
parent 2a6c9bc5f7
commit a603e69599
5 changed files with 9 additions and 11 deletions

View file

@ -5,7 +5,7 @@
*/
#include <AK/StringBuilder.h>
#include <AK/URLParser.h>
#include <AK/URL.h>
#include <LibWeb/URLEncoder.h>
namespace Web {
@ -14,9 +14,9 @@ String urlencode(const Vector<URLQueryParam>& pairs)
{
StringBuilder builder;
for (size_t i = 0; i < pairs.size(); ++i) {
builder.append(urlencode(pairs[i].name));
builder.append(URL::percent_encode(pairs[i].name));
builder.append('=');
builder.append(urlencode(pairs[i].value));
builder.append(URL::percent_encode(pairs[i].value));
if (i != pairs.size() - 1)
builder.append('&');
}