summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-10 21:13:00 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-10 21:13:00 +0100
commit9641f7431015abd0222a440cb75fb3149ef70189 (patch)
treea43216c7b80d6f1f01493d609ebc9bd3f241b110
parent40b7d814c3c207c9bf20658ee76204a6c5fac599 (diff)
downloadserenity-9641f7431015abd0222a440cb75fb3149ef70189.zip
AK: Teach URL::complete_url() how to resolve URL's starting with "/"
-rw-r--r--AK/URL.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/AK/URL.cpp b/AK/URL.cpp
index a78ce8a9b4..45dcb2e4a8 100644
--- a/AK/URL.cpp
+++ b/AK/URL.cpp
@@ -157,8 +157,14 @@ URL URL::complete_url(const String& string) const
if (url.is_valid())
return url;
- FileSystemPath fspath(path());
+ if (string.starts_with("/")) {
+ url = *this;
+ url.set_path(string);
+ return url;
+ }
+
StringBuilder builder;
+ FileSystemPath fspath(path());
builder.append('/');
bool document_url_ends_in_slash = path()[path().length() - 1] == '/';