[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - wsd/DocumentBroker.cpp

Andras Timar (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 29 07:24:45 UTC 2019


 wsd/DocumentBroker.cpp |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 050a950913172932a7ac3b45f4f483f01138f1c6
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Fri Nov 29 08:23:07 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Nov 29 08:24:01 2019 +0100

    Revert "tdf#125755: Fix some URI encoding issues"
    
    This reverts commit 1879a45a057b04a8f2d23b505b5c931f9c9e4151.
    
    Unfortunately it broke full screen slideshow and document download functionality,
    and the fix would have been hard.
    
    Change-Id: Iba9d9d8486cc03b7151e392b8be9d5e86c04db46

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 03c6edf5d..30d6d5e8d 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -90,7 +90,9 @@ std::string getCachePath(const std::string& uri)
 Poco::URI DocumentBroker::sanitizeURI(const std::string& uri)
 {
     // The URI of the document should be url-encoded.
-    Poco::URI uriPublic(uri);
+    std::string decodedUri;
+    Poco::URI::decode(uri, decodedUri);
+    Poco::URI uriPublic(decodedUri);
 
     if (uriPublic.isRelative() || uriPublic.getScheme() == "file")
     {
@@ -739,8 +741,9 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
         LOG_INF("SHA1 for DocKey [" << _docKey << "] of [" << LOOLWSD::anonymizeUrl(localPath) << "]: " <<
                 Poco::DigestEngine::digestToHex(sha1.digest()));
 
+        // LibreOffice can't open files with '#' in the name
         std::string localPathEncoded;
-        Poco::URI::encode(localPath, "#?", localPathEncoded);
+        Poco::URI::encode(localPath, "#", localPathEncoded);
         _uriJailed = Poco::URI(Poco::URI("file://"), localPathEncoded).toString();
         _uriJailedAnonym = Poco::URI(Poco::URI("file://"), LOOLWSD::anonymizeUrl(localPathEncoded)).toString();
 


More information about the Libreoffice-commits mailing list