mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibWebView: Avoid trying to break a schemeless URL into renderable parts
This commit is contained in:
parent
65a9eae142
commit
965bd00cf3
Notes:
sideshowbarker
2024-07-16 23:44:30 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/965bd00cf3 Pull-request: https://github.com/SerenityOS/serenity/pull/22158 Issue: https://github.com/SerenityOS/serenity/issues/22157 Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 9 additions and 1 deletions
|
@ -24,6 +24,10 @@ TEST_CASE(invalid_url)
|
|||
EXPECT(!WebView::break_url_into_parts(":/"sv).has_value());
|
||||
EXPECT(!WebView::break_url_into_parts("://"sv).has_value());
|
||||
|
||||
EXPECT(!WebView::break_url_into_parts("/"sv).has_value());
|
||||
EXPECT(!WebView::break_url_into_parts("//"sv).has_value());
|
||||
EXPECT(!WebView::break_url_into_parts("/h"sv).has_value());
|
||||
|
||||
EXPECT(!WebView::break_url_into_parts("f"sv).has_value());
|
||||
EXPECT(!WebView::break_url_into_parts("fi"sv).has_value());
|
||||
EXPECT(!WebView::break_url_into_parts("fil"sv).has_value());
|
||||
|
|
|
@ -144,7 +144,11 @@ Optional<URLParts> break_url_into_parts(StringView url_string)
|
|||
if (!url.is_valid())
|
||||
return {};
|
||||
|
||||
auto scheme_length = url.scheme().bytes_as_string_view().length();
|
||||
auto const& scheme = url.scheme();
|
||||
auto scheme_length = scheme.bytes_as_string_view().length();
|
||||
|
||||
if (!url_string.starts_with(scheme))
|
||||
return {};
|
||||
if (!url_string.substring_view(scheme_length).starts_with("://"sv))
|
||||
return {};
|
||||
|
||||
|
|
Loading…
Reference in a new issue