wsd/DocumentBroker.cpp | 3 +++ wsd/Storage.cpp | 2 ++ wsd/Storage.hpp | 9 ++++++++- wsd/reference.txt | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-)
New commits: commit 97109d44021c94db0fe2ef5b67844baf2f5e1902 Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Sep 25 19:16:48 2017 +0200 PutFile ext: X-LOOL-WOPI-IsModifiedByUser header to indicate modifications. Change-Id: I5d69903211045969d678df695717eae7452e7f04 Reviewed-on: https://gerrit.libreoffice.org/42856 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 9d6bff46..884e132b 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -774,6 +774,9 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat // arguments end oss << "}"; + assert(_storage); + _storage->setUserModified(_isModified); + const auto saveArgs = oss.str(); LOG_TRC(".uno:Save arguments: " << saveArgs); const auto command = "uno .uno:Save " + saveArgs; diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp index afe69a87..eab3db3c 100644 --- a/wsd/Storage.cpp +++ b/wsd/Storage.cpp @@ -643,6 +643,8 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const std::string& a Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uriObject.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1); request.set("X-WOPI-Override", "PUT"); + request.set("X-LOOL-WOPI-IsModifiedByUser", _isUserModified? "true": "false"); + request.setContentType("application/octet-stream"); request.setContentLength(size); addStorageDebugCookie(request); diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp index a3fbe637..58cb0545 100644 --- a/wsd/Storage.hpp +++ b/wsd/Storage.hpp @@ -70,7 +70,8 @@ public: _localStorePath(localStorePath), _jailPath(jailPath), _fileInfo("", "lool", Poco::Timestamp::fromEpochTime(0), 0), - _isLoaded(false) + _isLoaded(false), + _isUserModified(false) { LOG_DBG("Storage ctor: " << uri.toString()); } @@ -82,6 +83,9 @@ public: bool isLoaded() const { return _isLoaded; } + /// To be able to set the WOPI extension header appropriately. + void setUserModified(bool isUserModified) { _isUserModified = isUserModified; } + /// Returns the basic information about the file. const FileInfo& getFileInfo() const { return _fileInfo; } @@ -116,6 +120,9 @@ protected: FileInfo _fileInfo; bool _isLoaded; + /// The document has been modified by the user. + bool _isUserModified; + static bool FilesystemEnabled; static bool WopiEnabled; /// Allowed/denied WOPI hosts, if any and if WOPI is enabled. diff --git a/wsd/reference.txt b/wsd/reference.txt index f6ad3985..1137bff6 100644 --- a/wsd/reference.txt +++ b/wsd/reference.txt @@ -61,3 +61,14 @@ WatermarkText Note that it is possible to just hide print,save,export options while still being able to access them from WOPI hosts using PostMessage API (see loleaflet/reference.html) + +PutFile headers +--------------- + +PutFile additionally indicates whether the user has modified the document +before the save, or if they just pressed the Save button without any +modification. The following header: + + X-LOOL-WOPI-IsModifiedByUser + +will have the value 'true' or 'false' accordingly. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits