1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:17:44 +00:00

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.
This commit is contained in:
Shannon Booth 2023-06-03 17:41:59 +12:00 committed by Sam Atkins
parent 83345ba698
commit 484635651c

View file

@ -468,7 +468,9 @@ void Tab::focus_location_editor()
void Tab::navigate(QString url, LoadType load_type) 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; url = "https://" + url;
m_is_history_navigation = (load_type == LoadType::HistoryNavigation); m_is_history_navigation = (load_type == LoadType::HistoryNavigation);
view().load(ak_deprecated_string_from_qstring(url)); view().load(ak_deprecated_string_from_qstring(url));