mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +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
Notes:
sideshowbarker
2024-07-17 00:37:23 +09:00
Author: https://github.com/vkoskiv Commit: https://github.com/SerenityOS/serenity/commit/838d586b25 Pull-request: https://github.com/SerenityOS/serenity/pull/19450
1 changed files with 2 additions and 1 deletions
|
@ -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