Skip to content

Commit

Permalink
fix: use Unicode version of ShellExecute() in OpenExternalOnWorkerThr…
Browse files Browse the repository at this point in the history
…ead() (#20906)
  • Loading branch information
trop[bot] authored and codebytere committed Nov 2, 2019
1 parent 47eb123 commit 028e388
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions shell/common/platform_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,11 @@ std::string OpenExternalOnWorkerThread(
// Quote the input scheme to be sure that the command does not have
// parameters unexpected by the external program. This url should already
// have been escaped.
std::string escaped_url = url.spec();
escaped_url.insert(0, "\"");
escaped_url += "\"";

std::string working_dir = options.working_dir.AsUTF8Unsafe();
base::string16 escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\"";
base::string16 working_dir = options.working_dir.value();

if (reinterpret_cast<ULONG_PTR>(
ShellExecuteA(nullptr, "open", escaped_url.c_str(), nullptr,
ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr,
working_dir.empty() ? nullptr : working_dir.c_str(),
SW_SHOWNORMAL)) <= 32) {
return "Failed to open";
Expand Down

0 comments on commit 028e388

Please sign in to comment.