fix: ShowItemUsingFileManager should escape path in Linux (#40527)

This commit is contained in:
Xie Jingyi 2023-11-20 08:00:56 +08:00 committed by GitHub
parent 67894f1493
commit 2c03b8fd6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@
#include "base/posix/eintr_wrapper.h" #include "base/posix/eintr_wrapper.h"
#include "base/process/kill.h" #include "base/process/kill.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/strings/escape.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "components/dbus/thread_linux/dbus_thread_linux.h" #include "components/dbus/thread_linux/dbus_thread_linux.h"
@ -216,7 +217,8 @@ class ShowItemHelper {
dbus::MessageWriter writer(&show_items_call); dbus::MessageWriter writer(&show_items_call);
writer.AppendArrayOfStrings( writer.AppendArrayOfStrings(
{"file://" + full_path.value()}); // List of file(s) to highlight. {"file://" + base::EscapePath(
full_path.value())}); // List of file(s) to highlight.
writer.AppendString({}); // startup-id writer.AppendString({}); // startup-id
ShowItemUsingBusCall(&show_items_call, full_path); ShowItemUsingBusCall(&show_items_call, full_path);