LibURL: Make percent_encode_after_encoding infallible

This commit is contained in:
Shannon Booth
2024-08-11 00:05:22 +12:00
committed by Tim Ledbetter
parent 264b5160c2
commit 4bb211ba88
3 changed files with 8 additions and 8 deletions

View File

@@ -62,10 +62,10 @@ ErrorOr<String> url_encode(Vector<QueryParam> const& tuples, StringView encoding
// 1. Assert: tuples name and tuples value are scalar value strings.
// 2. Let name be the result of running percent-encode after encoding with encoding, tuples name, the application/x-www-form-urlencoded percent-encode set, and true.
auto name = TRY(URL::Parser::percent_encode_after_encoding(*encoder, tuple.name, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true));
auto name = URL::Parser::percent_encode_after_encoding(*encoder, tuple.name, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true);
// 3. Let value be the result of running percent-encode after encoding with encoding, tuples value, the application/x-www-form-urlencoded percent-encode set, and true.
auto value = TRY(URL::Parser::percent_encode_after_encoding(*encoder, tuple.value, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true));
auto value = URL::Parser::percent_encode_after_encoding(*encoder, tuple.value, URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded, true);
// 4. If output is not the empty string, then append U+0026 (&) to output.
if (!output.is_empty())