wsd/DocumentBroker.cpp | 6 ++++-- wsd/Storage.cpp | 4 +--- wsd/Storage.hpp | 9 +++++++-- 3 files changed, 12 insertions(+), 7 deletions(-)
New commits: commit ffdac3dc8c0aee3f76409d16632bcef595e9fe2f Author: Ashod Nakashian <[email protected]> Date: Tue Mar 21 22:56:16 2017 -0400 wsd: fix saving of modified documents Detection of modified documents used the directory path rather than the document path, which obviously wasn't correct. Reviewed-on: https://gerrit.libreoffice.org/35526 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> (cherry picked from commit 0314f8751c76482216f8f7fe842c2f615e8526d6) Change-Id: I4a054a9ce2b64d70cd7a0a1c488dcc38ef46a581 Reviewed-on: https://gerrit.libreoffice.org/35550 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> (cherry picked from commit 8962addd234c3574148858d3b181f4ed91f2ca0b) Reviewed-on: https://gerrit.libreoffice.org/35581 diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 886cf98c..49873008 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -310,7 +310,7 @@ bool DocumentBroker::load(std::shared_ptr<ClientSession>& session, const std::st _filename = fileInfo._filename; // Use the local temp file's timestamp. - _lastFileModifiedTime = Poco::File(_storage->getLocalRootPath()).getLastModified(); + _lastFileModifiedTime = Poco::File(_storage->getRootFilePath()).getLastModified(); _tileCache.reset(new TileCache(_uriPublic.toString(), _lastFileModifiedTime, _cacheRoot)); } @@ -345,6 +345,8 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std: // If save requested, but core didn't save because document was unmodified // notify the waiting thread, if any. + LOG_TRC("Saving to storage docKey [" << _docKey << "] for session [" << sessionId << + "]. Success: " << success << ", result: " << result); if (!success && result == "unmodified") { LOG_DBG("Save skipped as document was not modified"); @@ -354,7 +356,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std: // If we aren't destroying the last editable session just yet, and the file // timestamp hasn't changed, skip saving. - const auto newFileModifiedTime = Poco::File(_storage->getLocalRootPath()).getLastModified(); + const auto newFileModifiedTime = Poco::File(_storage->getRootFilePath()).getLastModified(); if (!_lastEditableSession && newFileModifiedTime == _lastFileModifiedTime) { // Nothing to do. diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp index a2ca75bc..b9df6b2e 100644 --- a/wsd/Storage.cpp +++ b/wsd/Storage.cpp @@ -207,11 +207,9 @@ LocalStorage::LocalFileInfo LocalStorage::getLocalFileInfo(const Poco::URI& uriP std::string LocalStorage::loadStorageFileToLocal() { - const auto rootPath = getLocalRootPath(); - // /chroot/jailId/user/doc/childId/file.ext const auto filename = Poco::Path(_uri.getPath()).getFileName(); - _jailedFilePath = Poco::Path(rootPath, filename).toString(); + _jailedFilePath = Poco::Path(getLocalRootPath(), filename).toString(); LOG_INF("Public URI [" << _uri.getPath() << "] jailed to [" + _jailedFilePath + "]."); diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp index 684488f4..8816a9e0 100644 --- a/wsd/Storage.hpp +++ b/wsd/Storage.hpp @@ -73,10 +73,11 @@ public: Log::debug("Storage ctor: " + uri.toString()); } - std::string getLocalRootPath() const; - const std::string getUri() const { return _uri.toString(); } + /// Returns the root path to the jailed file. + const std::string& getRootFilePath() const { return _jailedFilePath; }; + bool isLoaded() const { return _isLoaded; } /// Returns the basic information about the file. @@ -98,6 +99,10 @@ public: static std::unique_ptr<StorageBase> create(const Poco::URI& uri, const std::string& jailRoot, const std::string& jailPath); +protected: + + /// Returns the root path of the jail directory of docs. + std::string getLocalRootPath() const; protected: const Poco::URI _uri; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
