From 484635651cc997b290625fa12f03912128147e03 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 3 Jun 2023 17:41:59 +1200 Subject: [PATCH] Ladybird: Assume file:// URL when URL starts with '/' Allowing for easily pasting into ladybird the path to some HTML file (as an example). This behavior matches chrome and firefox handling. --- Ladybird/Tab.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Ladybird/Tab.cpp b/Ladybird/Tab.cpp index 47fe7ea519..50286be1ca 100644 --- a/Ladybird/Tab.cpp +++ b/Ladybird/Tab.cpp @@ -468,7 +468,9 @@ void Tab::focus_location_editor() void Tab::navigate(QString url, LoadType load_type) { - if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive) && !url.startsWith("file://", Qt::CaseInsensitive) && !url.startsWith("about:", Qt::CaseInsensitive)) + if (url.startsWith("/")) + url = "file://" + url; + else if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive) && !url.startsWith("file://", Qt::CaseInsensitive) && !url.startsWith("about:", Qt::CaseInsensitive)) url = "https://" + url; m_is_history_navigation = (load_type == LoadType::HistoryNavigation); view().load(ak_deprecated_string_from_qstring(url));