mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-02 22:24:26 +00:00
AK: Fix relative file URL parsing in URLParser
The FileSlash state was erroneously copying the base URL host, instead of the base URL path excluding the last path component. This resulted in invalid file URLs.
This commit is contained in:
parent
db121c7af1
commit
838d586b25
|
@ -553,7 +553,8 @@ URL URLParser::parse(StringView raw_input, Optional<URL> const& base_url, Option
|
|||
report_validation_error();
|
||||
state = State::FileHost;
|
||||
} else if (base_url.has_value() && base_url->m_scheme == "file") {
|
||||
url->m_host = base_url->m_host;
|
||||
url->m_paths = base_url->m_paths;
|
||||
url->m_paths.remove(url->m_paths.size() - 1);
|
||||
auto substring_from_pointer = input.substring_view(iterator - input.begin()).as_string();
|
||||
if (!starts_with_windows_drive_letter(substring_from_pointer) && is_normalized_windows_drive_letter(base_url->m_paths[0]))
|
||||
url->append_path(base_url->m_paths[0], URL::ApplyPercentEncoding::No);
|
||||
|
|
Loading…
Reference in a new issue