Everywhere: Remove some use of the URL constructors

These make it too easy to construct an invalid URL, which makes it
difficult to remove the valid state of URL - which this API relies
on.
This commit is contained in:
Shannon Booth 2025-02-16 14:45:52 +13:00 committed by Tim Flynn
commit d62cf0a807
Notes: github-actions[bot] 2025-02-19 13:02:46 +00:00
11 changed files with 341 additions and 329 deletions

View file

@ -7,6 +7,7 @@
#include <AK/String.h>
#include <LibFileSystem/FileSystem.h>
#include <LibURL/Parser.h>
#include <LibWebView/URL.h>
namespace WebView {
@ -25,7 +26,7 @@ Optional<URL::URL> sanitize_url(StringView url, Optional<StringView> search_engi
if (!search_engine.has_value())
return {};
return MUST(String::formatted(*search_engine, URL::percent_decode(url)));
return URL::Parser::basic_parse(MUST(String::formatted(*search_engine, URL::percent_decode(url))));
};
ByteString url_with_scheme = url;