diff options
author | Shannon Booth <shannon.ml.booth@gmail.com> | 2023-06-03 17:41:59 +1200 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-06-03 11:43:35 +0100 |
commit | 484635651cc997b290625fa12f03912128147e03 (patch) | |
tree | 15ed1ad3b615549174c1f228dca5a6bc89e1dadc | |
parent | 83345ba6983da0017338b4a49ea8110e2c72fff6 (diff) | |
download | serenity-484635651cc997b290625fa12f03912128147e03.zip |
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.
-rw-r--r-- | Ladybird/Tab.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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)); |