From ff7ca5c48c316e07b1bf631b2d7ed14c358dfa42 Mon Sep 17 00:00:00 2001 From: Diego Frias Date: Sat, 13 Jul 2024 12:04:42 -0700 Subject: [PATCH] LibWebView: Trim whitespace when sanitizing file paths Previously, the presence of surrounding whitespace would give file paths the `https` schema instead of the `file` schema, making navigation unsuccessful. --- Userland/Libraries/LibWebView/URL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWebView/URL.cpp b/Userland/Libraries/LibWebView/URL.cpp index 7b6cc258217..2374fe7bfef 100644 --- a/Userland/Libraries/LibWebView/URL.cpp +++ b/Userland/Libraries/LibWebView/URL.cpp @@ -36,8 +36,8 @@ Optional get_public_suffix([[maybe_unused]] StringView host) Optional sanitize_url(StringView url, Optional 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 {};