1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:37:45 +00:00

AK: Port URL::m_query from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-08-12 19:28:19 +12:00 committed by Andrew Kaster
parent 55a01e72ca
commit 21fe86d235
14 changed files with 63 additions and 75 deletions

View file

@ -393,15 +393,16 @@ bool Launcher::open_file_url(const URL& url)
Vector<DeprecatedString> additional_parameters;
DeprecatedString filepath = url.serialize_path();
auto parameters = url.query().split('&');
for (auto const& parameter : parameters) {
auto pair = parameter.split('=');
if (pair.size() == 2 && pair[0] == "line_number") {
auto line = pair[1].to_int();
if (line.has_value())
// TextEditor uses file:line:col to open a file at a specific line number
filepath = DeprecatedString::formatted("{}:{}", filepath, line.value());
}
if (url.query().has_value()) {
url.query()->bytes_as_string_view().for_each_split_view('&', SplitBehavior::Nothing, [&](auto parameter) {
auto pair = parameter.split_view('=');
if (pair.size() == 2 && pair[0] == "line_number") {
auto line = pair[1].to_int();
if (line.has_value())
// TextEditor uses file:line:col to open a file at a specific line number
filepath = DeprecatedString::formatted("{}:{}", filepath, line.value());
}
});
}
additional_parameters.append(filepath);