summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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] == '/';