summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-07-14 17:57:18 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-07-19 15:39:05 +0200
commit40be9dc9c7a4362a7357722380b6f430157d707b (patch)
treef3ee66db452155b27ce9cc37366271b4960974cb /tools
parent3f706577ab05242b3a914eb183197b0d532764ee (diff)
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.stahl@allotropia.de> (cherry picked from commit 54aebc2c8ff25f17a4083fe6c60c38c4f391af12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137177 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/fsys/fileutil.cxx7
1 files changed, 6 insertions, 1 deletions
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
}