wsd/DocumentBroker.cpp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e71e37bcec84068e92434357df6172b9cf457e7e
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Thu Jul 2 08:16:00 2020 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Tue Jul 7 15:06:25 2020 +0200

    Improve reporting save results
    
    Change-Id: I3f2f96f4b8f196e6e9268bed24695f739f679124
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97699
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index e64c0f8e1..a6b8c62e2 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -970,8 +970,8 @@ bool DocumentBroker::saveToStorageInternal(const 
std::string& sessionId, bool su
     {
         LOG_DBG("Save skipped as document [" << _docKey << "] was not 
modified.");
         _lastSaveTime = std::chrono::steady_clock::now();
-        _poll->wakeup();
         broadcastSaveResult(true, "unmodified");
+        _poll->wakeup();
         return true;
     }
 
@@ -1116,7 +1116,7 @@ bool DocumentBroker::saveToStorageInternal(const 
std::string& sessionId, bool su
         LOG_ERR("Cannot save docKey [" << _docKey << "] to storage URI [" << 
uriAnonym <<
                 "]. Invalid or expired access token. Notifying client.");
         it->second->sendTextFrameAndLogError("error: cmd=storage 
kind=saveunauthorized");
-        broadcastSaveResult(false, "Invalid or expired access token", 
storageSaveResult.getErrorMsg());
+        broadcastSaveResult(false, "Invalid or expired access token");
     }
     else if (storageSaveResult.getResult() == StorageBase::SaveResult::FAILED)
     {
@@ -1144,9 +1144,9 @@ bool DocumentBroker::saveToStorageInternal(const 
std::string& sessionId, bool su
 
 void DocumentBroker::broadcastSaveResult(bool success, const std::string& 
result, const std::string& errorMsg)
 {
-    std::string resultstr = success ? "true" : "false";
+    const std::string resultstr = success ? "true" : "false";
     // Some sane limit, otherwise we get problems transfering this to the 
client with large strings (can be a whole webpage)
-    std::string errorMsgFormatted = errorMsg.substr(0, 1000);
+    std::string errorMsgFormatted = 
LOOLProtocol::getAbbreviatedMessage(errorMsg);
     // Replace reserverd characters
     errorMsgFormatted = Poco::translate(errorMsgFormatted, "\"", "'");
     broadcastMessage("commandresult: { \"command\": \"save\", \"success\": " + 
resultstr +
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to