mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 19:28:48 +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())
|
||||
|
|
|
@ -203,8 +203,8 @@ private:
|
|||
AK::CopyOnWrite<Data> m_data;
|
||||
};
|
||||
|
||||
URL create_with_url_or_path(ByteString const&);
|
||||
URL create_with_file_scheme(ByteString const& path, ByteString const& fragment = {}, ByteString const& hostname = {});
|
||||
Optional<URL> create_with_url_or_path(ByteString const&);
|
||||
Optional<URL> create_with_file_scheme(ByteString const& path, ByteString const& fragment = {}, ByteString const& hostname = {});
|
||||
URL create_with_data(StringView mime_type, StringView payload, bool is_base64 = false);
|
||||
|
||||
bool is_public_suffix(StringView host);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue