From 2c03b8fd6be5029dce0a78849860e5f57a3b3026 Mon Sep 17 00:00:00 2001 From: Xie Jingyi Date: Mon, 20 Nov 2023 08:00:56 +0800 Subject: [PATCH] fix: ShowItemUsingFileManager should escape path in Linux (#40527) --- shell/common/platform_util_linux.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/common/platform_util_linux.cc b/shell/common/platform_util_linux.cc index bbfa3e63ce91..e29ace1c64c7 100644 --- a/shell/common/platform_util_linux.cc +++ b/shell/common/platform_util_linux.cc @@ -21,6 +21,7 @@ #include "base/posix/eintr_wrapper.h" #include "base/process/kill.h" #include "base/process/launch.h" +#include "base/strings/escape.h" #include "base/strings/string_util.h" #include "base/threading/thread_restrictions.h" #include "components/dbus/thread_linux/dbus_thread_linux.h" @@ -216,8 +217,9 @@ class ShowItemHelper { dbus::MessageWriter writer(&show_items_call); writer.AppendArrayOfStrings( - {"file://" + full_path.value()}); // List of file(s) to highlight. - writer.AppendString({}); // startup-id + {"file://" + base::EscapePath( + full_path.value())}); // List of file(s) to highlight. + writer.AppendString({}); // startup-id ShowItemUsingBusCall(&show_items_call, full_path); }