mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
AK: Handle "protocol relative URLs" in URL::complete_url()
This commit is contained in:
parent
91f70a9258
commit
b193670967
Notes:
sideshowbarker
2024-07-19 06:36:02 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/b1936709678 Pull-request: https://github.com/SerenityOS/serenity/pull/2253 Issue: https://github.com/SerenityOS/serenity/issues/2250
1 changed files with 6 additions and 0 deletions
|
@ -293,6 +293,12 @@ URL URL::complete_url(const String& string) const
|
|||
if (url.is_valid())
|
||||
return url;
|
||||
|
||||
if (string.starts_with("//")) {
|
||||
URL url(String::format("%s:%s", m_protocol.characters(), string.characters()));
|
||||
if (url.is_valid())
|
||||
return url;
|
||||
}
|
||||
|
||||
if (string.starts_with("/")) {
|
||||
url = *this;
|
||||
url.set_path(string);
|
||||
|
|
Loading…
Add table
Reference in a new issue