[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 7 13:06:44 UTC 2020
wsd/DocumentBroker.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit e71e37bcec84068e92434357df6172b9cf457e7e
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Jul 2 08:16:00 2020 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at 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 <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at 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 +
More information about the Libreoffice-commits
mailing list