From 15601988a4b32e6ed4812dc7c7a423a2ebe361a2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 9 May 2020 16:14:37 +0200 Subject: [PATCH] AK: Allow file:// URLs to have a hostname --- AK/URL.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/AK/URL.cpp b/AK/URL.cpp index 1b063bb5e7..1d60fb53eb 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -103,10 +103,7 @@ bool URL::parse(const StringView& string) m_port = 80; else if (m_protocol == "https") m_port = 443; - if (m_protocol == "file") - state = State::InPath; - else - state = State::InHostname; + state = State::InHostname; buffer.clear(); continue; } @@ -253,8 +250,8 @@ String URL::to_string() const } builder.append("://"); + builder.append(m_host); if (protocol() != "file") { - builder.append(m_host); if (!(protocol() == "http" && port() == 80) && !(protocol() == "https" && port() == 443)) { builder.append(':'); builder.append(String::number(m_port));