shell/source/win32/SysShExec.cxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 739e6aa3b3cff6d63901f253e145b65a2fef2682 Author: Tünde Tóth <[email protected]> AuthorDate: Thu Nov 7 14:06:57 2019 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Tue Nov 12 22:23:45 2019 +0100 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 <[email protected]> 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; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
