diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index d77834816b..9c9a1787a7 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -90,11 +90,11 @@ static inline bool in_userinfo_set(u32 c) return in_path_set(c) || c == '/' || c == ':' || c == ';' || c == '=' || c == '@' || (c >= '[' && c <= '^') || c == '|'; } -String urlencode(const StringView& input) +String urlencode(const StringView& input, const StringView& exclude) { StringBuilder builder; for (unsigned char ch : input) { - if (in_userinfo_set((u8)ch)) { + if (in_userinfo_set((u8)ch) && !exclude.contains(ch)) { builder.append('%'); builder.appendff("{:02X}", ch); } else { diff --git a/AK/URLParser.h b/AK/URLParser.h index b315b104d8..a7ca9eb047 100644 --- a/AK/URLParser.h +++ b/AK/URLParser.h @@ -26,11 +26,11 @@ #pragma once -#include +#include namespace AK { -String urlencode(const StringView&); +String urlencode(const StringView&, const StringView& exclude = {}); String urldecode(const StringView&); }