mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +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
|
@ -163,7 +163,7 @@ Optional<u16> default_port_for_scheme(StringView scheme)
|
|||
return {};
|
||||
}
|
||||
|
||||
URL create_with_file_scheme(ByteString const& path, ByteString const& fragment, ByteString const& hostname)
|
||||
Optional<URL> create_with_file_scheme(ByteString const& path, ByteString const& fragment, ByteString const& hostname)
|
||||
{
|
||||
LexicalPath lexical_path(path);
|
||||
if (!lexical_path.is_absolute())
|
||||
|
@ -180,11 +180,10 @@ URL create_with_file_scheme(ByteString const& path, ByteString const& fragment,
|
|||
url_builder.append(fragment);
|
||||
}
|
||||
|
||||
auto url = Parser::basic_parse(url_builder.string_view());
|
||||
return url.has_value() ? url.release_value() : URL {};
|
||||
return Parser::basic_parse(url_builder.string_view());
|
||||
}
|
||||
|
||||
URL create_with_url_or_path(ByteString const& url_or_path)
|
||||
Optional<URL> create_with_url_or_path(ByteString const& url_or_path)
|
||||
{
|
||||
auto url = Parser::basic_parse(url_or_path);
|
||||
if (url.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue