mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
AK: Fix URL::complete_url behaviour for when a fragment is passed
Previously, passing a fragment string ("#section3") to the complete_url method would result in a URL that looked like "file:///home/anon/www/#section3" which was obviously incorrect. Now the result looks like "file:///home/anon/www/afrag.html#section3".
This commit is contained in:
parent
2e4147d0fc
commit
b1e4f70173
Notes:
sideshowbarker
2024-07-19 06:13:42 +09:00
Author: https://github.com/FalseHonesty Commit: https://github.com/SerenityOS/serenity/commit/b1e4f701735 Pull-request: https://github.com/SerenityOS/serenity/pull/2338
1 changed files with 6 additions and 0 deletions
|
@ -307,6 +307,12 @@ URL URL::complete_url(const String& string) const
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.starts_with("#")) {
|
||||||
|
url = *this;
|
||||||
|
url.set_fragment(string.substring(1, string.length() - 1));
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
FileSystemPath fspath(path());
|
FileSystemPath fspath(path());
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
|
|
Loading…
Reference in a new issue