summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVT
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-04-14 20:12:03 +0100
committerAndreas Kling <kling@serenityos.org>2023-04-15 06:37:04 +0200
commit35612c6a7f7602ff46d56bbbbc8b33b28b411409 (patch)
tree772aabbc417980448cb50df548d8ff4c2ac18ca1 /Userland/Libraries/LibVT
parent5acd40c525a695b353dba348a95eb0cb314a33d5 (diff)
downloadserenity-35612c6a7f7602ff46d56bbbbc8b33b28b411409.zip
AK+Everywhere: Change URL::path() to serialize_path()
This now defaults to serializing the path with percent decoded segments (which is what all callers expect), but has an option not to. This fixes `file://` URLs with spaces in their paths. The name has been changed to serialize_path() path to make it more clear that this method will generate a new string each call (except for the cannot_be_a_base_url() case). A few callers have then been updated to avoid repeatedly calling this function.
Diffstat (limited to 'Userland/Libraries/LibVT')
-rw-r--r--Userland/Libraries/LibVT/TerminalWidget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp
index 1a0468ab67..23ec4d155b 100644
--- a/Userland/Libraries/LibVT/TerminalWidget.cpp
+++ b/Userland/Libraries/LibVT/TerminalWidget.cpp
@@ -867,7 +867,7 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
auto handlers = Desktop::Launcher::get_handlers_for_url(attribute.href);
if (!handlers.is_empty()) {
auto url = URL(attribute.href);
- auto path = url.path();
+ auto path = url.serialize_path();
auto app_file = Desktop::AppFile::get_for_app(LexicalPath::basename(handlers[0]));
auto app_name = app_file->is_valid() ? app_file->name() : LexicalPath::basename(handlers[0]);
@@ -1146,7 +1146,7 @@ void TerminalWidget::context_menu_event(GUI::ContextMenuEvent& event)
}));
m_context_menu_for_hyperlink->add_action(GUI::Action::create("Copy &Name", [&](auto&) {
// file://courage/home/anon/something -> /home/anon/something
- auto path = URL(m_context_menu_href).path();
+ auto path = URL(m_context_menu_href).serialize_path();
// /home/anon/something -> something
auto name = LexicalPath::basename(path);
GUI::Clipboard::the().set_plain_text(name);
@@ -1177,7 +1177,7 @@ void TerminalWidget::drop_event(GUI::DropEvent& event)
send_non_user_input(" "sv.bytes());
if (url.scheme() == "file")
- send_non_user_input(url.path().bytes());
+ send_non_user_input(url.serialize_path().bytes());
else
send_non_user_input(url.to_deprecated_string().bytes());