mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:47:35 +00:00
AK: Serialize URL hosts with 'concept-host-serializer'
In order to follow spec text to achieve this, we need to change the underlying representation of a host in AK::URL to deserialized format. Before this, we were parsing the host and then immediately serializing it again. Making that change resulted in a whole bunch of fallout. After this change, callers can access the serialized data through this concept-host-serializer. The functional end result of this change is that IPv6 hosts are now correctly serialized to be surrounded with '[' and ']'.
This commit is contained in:
parent
768f070b86
commit
8751be09f9
36 changed files with 175 additions and 143 deletions
|
@ -679,7 +679,7 @@ ErrorOr<void> BarewordLiteral::highlight_in_editor(Line::Editor& editor, Shell&
|
|||
if (FileSystem::exists(m_text)) {
|
||||
auto realpath = shell.resolve_path(m_text.bytes_as_string_view());
|
||||
auto url = URL::create_with_file_scheme(realpath);
|
||||
url.set_host(shell.hostname);
|
||||
url.set_host(TRY(String::from_deprecated_string(shell.hostname)));
|
||||
editor.stylize({ m_position.start_offset, m_position.end_offset }, { Line::Style::Hyperlink(url.to_deprecated_string()) });
|
||||
}
|
||||
return {};
|
||||
|
@ -2620,7 +2620,7 @@ ErrorOr<void> PathRedirectionNode::highlight_in_editor(Line::Editor& editor, She
|
|||
if (!path.starts_with('/'))
|
||||
path = String::formatted("{}/{}", shell.cwd, path).release_value_but_fixme_should_propagate_errors();
|
||||
auto url = URL::create_with_file_scheme(path.to_deprecated_string());
|
||||
url.set_host(shell.hostname);
|
||||
url.set_host(TRY(String::from_deprecated_string(shell.hostname)));
|
||||
editor.stylize({ position.start_offset, position.end_offset }, { Line::Style::Hyperlink(url.to_deprecated_string()) });
|
||||
}
|
||||
return {};
|
||||
|
@ -3214,7 +3214,7 @@ ErrorOr<void> Juxtaposition::highlight_in_editor(Line::Editor& editor, Shell& sh
|
|||
if (FileSystem::exists(path)) {
|
||||
auto realpath = shell.resolve_path(path);
|
||||
auto url = URL::create_with_file_scheme(realpath);
|
||||
url.set_host(shell.hostname);
|
||||
url.set_host(TRY(String::from_deprecated_string(shell.hostname)));
|
||||
editor.stylize({ m_position.start_offset, m_position.end_offset }, { Line::Style::Hyperlink(url.to_deprecated_string()) });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue