mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-05 22:14:55 +00:00
AK: Directly append URL paths where applicable
This is a little closer to the spec text, and helps us avoid using the ApplyPercentEncoding flag.
This commit is contained in:
parent
fc44d09221
commit
c4d7be100e
2
AK/URL.h
2
AK/URL.h
|
@ -112,7 +112,7 @@ public:
|
|||
void append_slash()
|
||||
{
|
||||
// NOTE: To indicate that we want to end the path with a slash, we have to append an empty path segment.
|
||||
append_path("", ApplyPercentEncoding::No);
|
||||
m_paths.append("");
|
||||
}
|
||||
|
||||
DeprecatedString serialize_path(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
||||
|
|
|
@ -1359,7 +1359,7 @@ URL URLParser::basic_parse(StringView raw_input, Optional<URL> const& base_url,
|
|||
// 2. If the code point substring from pointer to the end of input does not start with a Windows drive letter and base’s path[0] is a normalized Windows drive letter, then append base’s path[0] to url’s path.
|
||||
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);
|
||||
url->m_paths.append(base_url->m_paths[0]);
|
||||
}
|
||||
|
||||
// 2. Set state to path state, and decrease pointer by 1.
|
||||
|
@ -1499,8 +1499,7 @@ URL URLParser::basic_parse(StringView raw_input, Optional<URL> const& base_url,
|
|||
buffer.append(':');
|
||||
}
|
||||
// 2. Append buffer to url’s path.
|
||||
// FIXME: It would be nicer (and closer to spec) if URLParser could just directly append the path.
|
||||
url->append_path(buffer.string_view(), URL::ApplyPercentEncoding::No);
|
||||
url->m_paths.append(buffer.string_view());
|
||||
}
|
||||
|
||||
// 5. Set buffer to the empty string.
|
||||
|
|
Loading…
Reference in New Issue
Block a user