Skip to content

Commit

Permalink
LibWebView: Invalid URLs no longer replaced with a ":"
Browse files Browse the repository at this point in the history
  • Loading branch information
mackfi committed Apr 21, 2024
1 parent ecb7d4b commit a957e68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Userland/Libraries/LibWebView/URL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace WebView {

static Optional<URL::URL> query_public_suffix_list(StringView url_string)
static Optional<URL::URL> query_public_suffix_list(StringView url_string, Optional<StringView> search_engine)
{
auto out = MUST(String::from_utf8(url_string));
if (!out.starts_with_bytes("about:"sv) && !out.contains("://"sv))
Expand All @@ -41,6 +41,9 @@ static Optional<URL::URL> query_public_suffix_list(StringView url_string)
if (host.ends_with_bytes(".local"sv) || host.ends_with_bytes("localhost"sv))
return url;
}
if (!search_engine.has_value()) {
return url;
}

return {};
}
Expand Down Expand Up @@ -90,7 +93,7 @@ Optional<URL::URL> sanitize_url(StringView url, Optional<StringView> search_engi
}
}

auto result = query_public_suffix_list(url);
auto result = query_public_suffix_list(url, search_engine);
if (!result.has_value())
return format_search_engine();

Expand Down

0 comments on commit a957e68

Please sign in to comment.