瀏覽代碼

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.
Diego Frias 1 年之前
父節點
當前提交
ff7ca5c48c
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibWebView/URL.cpp

+ 2 - 2
Userland/Libraries/LibWebView/URL.cpp

@@ -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)
 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())
         if (path.is_error())
             return {};
             return {};