diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-03-21 22:56:16 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-03-23 09:36:33 +0000 |
commit | 8962addd234c3574148858d3b181f4ed91f2ca0b (patch) | |
tree | f2ce94fc0ef4d9094d747706826a717699e01ccf | |
parent | d791ee053c146d0a60f75b57e294c9a122729366 (diff) |
wsd: fix saving of modified documents2.0.5
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 <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 0314f8751c76482216f8f7fe842c2f615e8526d6)
Change-Id: I4a054a9ce2b64d70cd7a0a1c488dcc38ef46a581
Reviewed-on: https://gerrit.libreoffice.org/35550
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | wsd/DocumentBroker.cpp | 6 | ||||
-rw-r--r-- | wsd/Storage.cpp | 4 | ||||
-rw-r--r-- | wsd/Storage.hpp | 9 |
3 files changed, 12 insertions, 7 deletions
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 96ec5113d..423474e19 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -324,7 +324,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)); } @@ -359,6 +359,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"); @@ -368,7 +370,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 585711f1c..d4426d721 100644 --- a/wsd/Storage.cpp +++ b/wsd/Storage.cpp @@ -207,11 +207,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 58d7ecb37..053332fc3 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; |