From be9fcaf92d6b9390ce2d91740ad945375921e44b Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 25 Jun 2023 14:11:34 +1200 Subject: [PATCH] AK: Expose URLParser::percent_encode_after_encoding This function is useful in places outside of the URLParser in LibWeb. --- AK/URLParser.cpp | 2 +- AK/URLParser.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index 644a57bf10..9f92f3c4db 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -117,7 +117,7 @@ constexpr bool is_double_dot_path_segment(StringView input) } // https://url.spec.whatwg.org/#string-percent-encode-after-encoding -static DeprecatedString percent_encode_after_encoding(StringView input, URL::PercentEncodeSet percent_encode_set, bool space_as_plus = false) +DeprecatedString URLParser::percent_encode_after_encoding(StringView input, URL::PercentEncodeSet percent_encode_set, bool space_as_plus) { // NOTE: This is written somewhat ad-hoc since we don't yet implement the Encoding spec. diff --git a/AK/URLParser.h b/AK/URLParser.h index 91b2d0068c..0eacf78ae8 100644 --- a/AK/URLParser.h +++ b/AK/URLParser.h @@ -57,6 +57,9 @@ public: static URL parse(StringView input, Optional const& base_url = {}, Optional url = {}, Optional state_override = {}); + // https://url.spec.whatwg.org/#string-percent-encode-after-encoding + static DeprecatedString percent_encode_after_encoding(StringView input, URL::PercentEncodeSet percent_encode_set, bool space_as_plus = false); + private: static Optional parse_data_url(StringView raw_input); };