diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-10 21:13:00 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-10 21:13:00 +0100 |
commit | 9641f7431015abd0222a440cb75fb3149ef70189 (patch) | |
tree | a43216c7b80d6f1f01493d609ebc9bd3f241b110 | |
parent | 40b7d814c3c207c9bf20658ee76204a6c5fac599 (diff) | |
download | serenity-9641f7431015abd0222a440cb75fb3149ef70189.zip |
AK: Teach URL::complete_url() how to resolve URL's starting with "/"
-rw-r--r-- | AK/URL.cpp | 8 |
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] == '/'; |