Skip to content

Commit

Permalink
LibWebView: Trim whitespace when sanitizing file paths
Browse files Browse the repository at this point in the history
Previously, the presence of surrounding whitespace would give file paths
the `https` schema instead of the `file` schema, making navigation
unsuccessful.
  • Loading branch information
dzfrias authored and tcl3 committed Jul 14, 2024
1 parent 9ce727d commit ff7ca5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Userland/Libraries/LibWebView/URL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Optional<String> get_public_suffix([[maybe_unused]] StringView host)

Optional<URL::URL> sanitize_url(StringView url, Optional<StringView> search_engine, AppendTLD append_tld)
{
if (FileSystem::exists(url)) {
auto path = FileSystem::real_path(url);
if (FileSystem::exists(url.trim_whitespace())) {
auto path = FileSystem::real_path(url.trim_whitespace());
if (path.is_error())
return {};

Expand Down

0 comments on commit ff7ca5c

Please sign in to comment.