mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 07:22:21 +00:00
LibURL: Port create_with_file_scheme to Optional
Removing one of the main remaining users of URL valid state.
This commit is contained in:
parent
2072eee83d
commit
00bbb2105b
Notes:
github-actions[bot]
2025-04-19 11:20:14 +00:00
Author: https://github.com/shannonbooth
Commit: 00bbb2105b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4401
Reviewed-by: https://github.com/trflynn89 ✅
5 changed files with 18 additions and 16 deletions
|
@ -35,10 +35,10 @@ Optional<URL::URL> sanitize_url(StringView location, Optional<SearchEngine> cons
|
|||
|
||||
auto url = URL::create_with_url_or_path(location);
|
||||
|
||||
if (!url.is_valid()) {
|
||||
if (!url.has_value()) {
|
||||
url = URL::create_with_url_or_path(ByteString::formatted("https://{}", location));
|
||||
|
||||
if (!url.is_valid())
|
||||
if (!url.has_value())
|
||||
return search_url_or_error();
|
||||
|
||||
https_scheme_was_guessed = true;
|
||||
|
@ -140,9 +140,10 @@ static URLParts break_web_url_into_parts(URL::URL const& url, StringView url_str
|
|||
|
||||
Optional<URLParts> break_url_into_parts(StringView url_string)
|
||||
{
|
||||
auto url = URL::create_with_url_or_path(url_string);
|
||||
if (!url.is_valid())
|
||||
auto maybe_url = URL::create_with_url_or_path(url_string);
|
||||
if (!maybe_url.has_value())
|
||||
return {};
|
||||
auto const& url = maybe_url.value();
|
||||
|
||||
auto const& scheme = url.scheme();
|
||||
auto scheme_length = scheme.bytes_as_string_view().length();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue