tools/source/fsys/fileutil.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
New commits: commit 444cdc0fae4b4551100276bb26bf94e0f6771918 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jul 14 17:57:18 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Jul 19 15:39:38 2022 +0200 tools: try to work around DavGetHTTPFromUNCPath() not URL-encoding path This was added in commit 20b1e6440aacab043753e93be4499e939a80b05b "tdf#126121: WebDAV redirection detection" and it works fine when i test it on my local Windows 10, returning an URL with encoded path. The logs from the customer system however show a http URL containing an unencoded ' ' in the path, which curl_url_set chokes on. Try to encode the returned URL with rtl_UriEncodeKeepEscapes, which should hopefully work in either situation. Change-Id: I6862fe0828307a13b0004b192153747d85bb3a42 (cherry picked from commit 66e25aad35cf538da86bdd0157428f4bed95258d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137173 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 54aebc2c8ff25f17a4083fe6c60c38c4f391af12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137178 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/tools/source/fsys/fileutil.cxx b/tools/source/fsys/fileutil.cxx index ec20e0a513bf..0e3512e5a160 100644 --- a/tools/source/fsys/fileutil.cxx +++ b/tools/source/fsys/fileutil.cxx @@ -10,6 +10,7 @@ #include <tools/fileutil.hxx> #if defined _WIN32 #include <osl/file.hxx> +#include <rtl/uri.hxx> #include <o3tl/char16_t2wchar_t.hxx> #define WIN32_LEAN_AND_MEAN #include <Windows.h> @@ -29,7 +30,11 @@ OUString UNCToDavURL(LPCWSTR sUNC) bufURL = std::make_unique<wchar_t[]>(nSize); nResult = DavGetHTTPFromUNCPath(sUNC, bufURL.get(), &nSize); } - return nResult == ERROR_SUCCESS ? OUString(o3tl::toU(bufURL.get())) : OUString(); + // looks like on different Windowses this may or may not be URL encoded? + return nResult == ERROR_SUCCESS + ? ::rtl::Uri::encode(OUString(o3tl::toU(bufURL.get())), rtl_UriCharClassUric, + rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8) + : OUString(); } #endif }