AK: Teach URL::complete_url() how to resolve URL's starting with "/"

This commit is contained in:
Andreas Kling 2019-12-10 21:13:00 +01:00
parent 40b7d814c3
commit 9641f74310
Notes: sideshowbarker 2024-07-19 10:53:45 +09:00

View file

@ -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] == '/';