[Libreoffice-commits] online.git: loolwsd/DocumentBroker.hpp loolwsd/MasterProcessSession.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Mar 14 03:13:24 UTC 2016


 loolwsd/DocumentBroker.hpp       |    3 ++-
 loolwsd/MasterProcessSession.cpp |   10 ++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit c6b47cc43768a37324691c7f003bfe7ad7fe68e1
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Mar 12 20:20:49 2016 -0500

    loolwsd: removed superfluous getJailPath
    
    Change-Id: Iff11ea791866f31a47cf0d0b1d1fb06d18f5be40
    Reviewed-on: https://gerrit.libreoffice.org/23218
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index e2cd9ee..71c9681 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -95,7 +95,7 @@ public:
     }
 
     /// Loads a document from the public URI into the jail.
-    bool load(const std::string& jailRoot, const std::string& jailId)
+    bool load(const std::string& jailId)
     {
         Log::debug("Loading from URI: " + _uriPublic.toString());
 
@@ -114,6 +114,7 @@ public:
 
         // user/doc/jailId
         const auto jailPath = Poco::Path(JailedDocumentRoot, jailId);
+        const std::string jailRoot = getJailRoot();
 
         Log::info("jailPath: " + jailPath.toString() + ", jailRoot: " + jailRoot);
 
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index d47f2b2..bdb730f 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -195,7 +195,7 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                     if (url.find(filePrefix) == 0)
                     {
                         // Rewrite file:// URLs, as they are visible to the outside world.
-                        Path path(MasterProcessSession::getJailPath(_childId), url.substr(filePrefix.length()));
+                        const Path path(_docBroker->getJailRoot(), url.substr(filePrefix.length()));
                         url = filePrefix + path.toString().substr(1);
                     }
                     peer->_saveAsQueue.put(url);
@@ -424,12 +424,6 @@ bool MasterProcessSession::haveSeparateProcess()
 {
     return !_childId.empty();
 }
-
-Poco::Path MasterProcessSession::getJailPath(const std::string& childId)
-{
-    return Path::forDirectory(LOOLWSD::ChildRoot + Path::separator() + childId);
-}
-
 bool MasterProcessSession::invalidateTiles(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
 {
     int part, tilePosX, tilePosY, tileWidth, tileHeight;
@@ -808,7 +802,7 @@ void MasterProcessSession::dispatchChild()
     }
 
     const auto jailRoot = Poco::Path(LOOLWSD::ChildRoot, childSession->_childId);
-    _docBroker->load(jailRoot.toString(), childSession->_childId);
+    _docBroker->load(childSession->_childId);
 
     _peer = childSession;
     childSession->_peer = shared_from_this();


More information about the Libreoffice-commits mailing list