wsd/DocumentBroker.cpp | 7 ++++--- wsd/Storage.cpp | 4 +--- wsd/Storage.hpp | 7 +++++-- 3 files changed, 10 insertions(+), 8 deletions(-)
New commits: commit 0314f8751c76482216f8f7fe842c2f615e8526d6 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. Change-Id: I4a054a9ce2b64d70cd7a0a1c488dcc38ef46a581 Reviewed-on: https://gerrit.libreoffice.org/35526 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 936fee9a..d3934d1b 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -473,7 +473,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)); } @@ -497,7 +497,6 @@ bool DocumentBroker::load(std::shared_ptr<ClientSession>& session, const std::st bool DocumentBroker::saveToStorage(const std::string& sessionId, bool success, const std::string& result) { - LOG_TRC("Saving to storage docKey [" << _docKey << "] for session [" << sessionId << "]: " << result); const bool res = saveToStorageInternal(sessionId, success, result); // If marked to destroy, then this was the last session. @@ -524,6 +523,8 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId, // 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 [" << _docKey << "] was not modified."); @@ -544,7 +545,7 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId, // 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 9d2f9917..639d057d 100644 --- a/wsd/Storage.cpp +++ b/wsd/Storage.cpp @@ -208,11 +208,9 @@ std::unique_ptr<LocalStorage::LocalFileInfo> LocalStorage::getLocalFileInfo(cons 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 4f642d62..7def9822 100644 --- a/wsd/Storage.hpp +++ b/wsd/Storage.hpp @@ -74,10 +74,9 @@ public: LOG_DBG("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; } @@ -101,6 +100,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
