summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2019-11-07 14:06:57 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-12 22:23:45 +0100
commit739e6aa3b3cff6d63901f253e145b65a2fef2682 (patch)
treea449793efa0b351126f9a1952db91c2353947d0c /shell
parent51b3252cc43c302de2307da15e9398912d044796 (diff)
tdf#54204 File URLs with fragment need toIUri conversion
Non-ASCII file links didn't work when the link contains anchor at the end. Note: The "correct" way to convert from a LO-internal to -external file URL would be the translateToExternal method of the css.uri.ExternalUriReferenceTranslator UNO service. But that translates the URL to be interpreted according to the current Windows code page (i.e., osl_getThreadTextEncoding), so only supports characters covered by that code page, and given that the result is passed into a Windows wchar_t API, ToIUri nicely avoids such potential conversion failure. Change-Id: I1a5b07366b0fea3da2fbe11a9378aacd765b5e04 Reviewed-on: https://gerrit.libreoffice.org/82219 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/SysShExec.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 73ef77bbe6a1..ccf932e71d03 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -33,6 +33,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <o3tl/runtimetooustring.hxx>
+#include <rtl/uri.hxx>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -431,6 +432,10 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
OUString aSystemPath;
if (::osl::FileBase::E_None == ::osl::FileBase::getSystemPathFromFileURL(preprocessed_command, aSystemPath))
preprocessed_command = aSystemPath;
+ else if (preprocessed_command.startsWithIgnoreAsciiCase("file:"))
+ //I use ToIUri conversion instead of the translateToExternal method of the css.uri.ExternalUriReferenceTranslator
+ //UNO service, because the translateToExternal method only supports characters covered by the current Windows code page.
+ preprocessed_command = rtl::Uri::decode(preprocessed_command, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
}
SHELLEXECUTEINFOW sei;