summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-01-15 17:16:02 +0100
committerAndras Timar <andras.timar@collabora.com>2020-06-23 16:08:15 +0200
commit1c707ce8efcb8dd435da3faff11775ee7cf81203 (patch)
tree8f3f9264baa55bd124f6ea81ee6508feaf3e498d
parentcd0d034110f5622131db8e2195da0939c8ef148f (diff)
Remove a fragment from a file URL early on
...as ShellExecuteExW would ignore it anyway Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86868 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 14b36a16b225bf7c988f118d499a7287c47cd83e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86877 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 51da0d22ff42b20ab38130b7874651ef136ecceb) Change-Id: I969db094bb7d2ea230ac8c36eb23d71a90fbe466
-rw-r--r--shell/source/win32/SysShExec.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 33554bd5608f..9ee49fd5db56 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -306,6 +306,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
static_cast< XSystemShellExecute* >( this ),
3 );
+ OUString preprocessed_command(aCommand);
if ((nFlags & URIS_ONLY) != 0)
{
css::uno::Reference< css::uri::XUriReference > uri(
@@ -319,6 +320,9 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
static_cast< cppu::OWeakObject * >(this), 0);
}
if (uri->getScheme().equalsIgnoreAsciiCase("file")) {
+ // ShellExecuteExW appears to ignore the fragment of a file URL anyway, so remove it:
+ uri->clearFragment();
+ preprocessed_command = uri->getUriReference();
OUString pathname;
auto const e1 = osl::FileBase::getSystemPathFromFileURL(aCommand, pathname);
if (e1 != osl::FileBase::E_None) {
@@ -422,7 +426,6 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
and names no existing file (remember the jump mark
sign '#' is a valid file name character we remove
the jump mark, else ShellExecuteEx fails */
- OUString preprocessed_command(aCommand);
if (is_system_path(preprocessed_command))
{
if (has_jump_mark(preprocessed_command) && !is_existing_file(preprocessed_command))