[Libreoffice-commits] online.git: Branch 'distro/cib/libreoffice-6-2' - 3 commits - configure.ac loleaflet/reference.html loleaflet/src wsd/Auth.cpp wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/Storage.cpp
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 8 08:37:09 UTC 2020
configure.ac | 2 +-
loleaflet/reference.html | 16 ++++++++++++++++
loleaflet/src/core/Socket.js | 7 +++++++
wsd/Auth.cpp | 3 ++-
wsd/DocumentBroker.cpp | 8 ++++----
wsd/LOOLWSD.cpp | 19 ++++++++++++++++++-
wsd/Storage.cpp | 7 +++++--
7 files changed, 53 insertions(+), 9 deletions(-)
New commits:
commit 7a3b244b7234b468e5a83022c3792674d0b892da
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Jul 8 10:33:17 2020 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Jul 8 10:33:17 2020 +0200
Release 6.2.10.0
diff --git a/configure.ac b/configure.ac
index 181a707f4..4b83ca624 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.63])
-AC_INIT([loolwsd], [6.2.9.0], [libreoffice at lists.freedesktop.org])
+AC_INIT([loolwsd], [6.2.10.0], [libreoffice at lists.freedesktop.org])
LT_INIT([shared, disable-static, dlopen])
AM_INIT_AUTOMAKE([1.10 subdir-objects tar-pax -Wno-portability])
commit d97784c5e4f33725394f7e27cdc10318dc5dc207
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: Wed Jul 8 10:26:10 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>
(cherry picked from commit e71e37bcec84068e92434357df6172b9cf457e7e)
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index a6e92498d..72777c6c0 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -782,8 +782,8 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
{
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;
}
@@ -895,7 +895,7 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
LOG_ERR("Cannot save docKey [" << _docKey << "] to storage URI [" << uriAnonym <<
"]. Invalid or expired access token. Notifying client.");
it->second->sendTextFrame("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)
{
@@ -921,9 +921,9 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
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 +
commit 0b367e1cbcbfa9a4c89e1fa792ee4c75ce762157
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue Jul 7 21:18:13 2020 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Jul 8 09:03:22 2020 +0200
Report back load result to integrator
Integrator currently gets no message when loading the document
from WOPI host fails.
Similiar to Action_Save_Resp, introduce Action_Load_Resp with
the result of the load action.
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 5dd40dbb1..dfce3de95 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -2976,6 +2976,22 @@ Actions response
<th>Values</th>
<th>Description</th>
</tr>
+ <tr>
+ <td><code><b>Action_Load_Result</b></code></td>
+ <td><code>
+ <nobr>success: <boolean></nobr>
+ <nobr>result: <string></nobr>
+ <nobr>errorMsg: <string></nobr>
+ </code></td>
+ <td>Acknowledgement when load finishes.<br/>
+ <code>success</code> tells if LOOL was able to load the document
+ successfully.<br/>
+ <code>result</code> contains the reason the document was not loaded.<br/>
+ <code>errorMsg</code> contains a detailed error message in case loading failed.
+ Probably it will contain the error message returned from the WOPI/Webdav host.
+ </td>
+ </tr>
+
<tr>
<td><code><b>Action_Save_Resp</b></code></td>
<td><code>
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 8f68b94ad..21a2cf4a3 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -323,6 +323,13 @@ L.Socket = L.Class.extend({
errorMsg: commandresult['errorMsg']
};
this._map.fire('postMessage', {msgId: 'Action_Save_Resp', args: postMessageObj});
+ } else if (commandresult['command'] === 'load') {
+ postMessageObj = {
+ success: commandresult['success'],
+ result: commandresult['result'],
+ errorMsg: commandresult['errorMsg']
+ };
+ this._map.fire('postMessage', {msgId: 'Action_Load_Resp', args: postMessageObj});
}
return;
}
diff --git a/wsd/Auth.cpp b/wsd/Auth.cpp
index 6be7eceea..9b5e3faaf 100644
--- a/wsd/Auth.cpp
+++ b/wsd/Auth.cpp
@@ -91,7 +91,8 @@ void Authorization::authorizeRequest(Poco::Net::HTTPRequest& request) const
break;
}
default:
- assert(false);
+ return;
+ //assert(false);
}
}
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 5415224fa..7b217cdb5 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -624,6 +624,20 @@ public:
namespace
{
+void sendLoadResult(std::shared_ptr<ClientSession> clientSession, bool success,
+ const std::string &errorMsg)
+{
+ const std::string result = success ? "" : "Error while loading document";
+ 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 = LOOLProtocol::getAbbreviatedMessage(errorMsg);
+ // Replace reserved characters
+ errorMsgFormatted = Poco::translate(errorMsg, "\"", "'");
+ clientSession->sendMessage("commandresult: { \"command\": \"load\", \"success\": " + resultstr +
+ ", \"result\": \"" + result + "\", \"errorMsg\": \"" + errorMsgFormatted + "\"}");
+}
+
inline std::string getLaunchBase(const std::string &credentials)
{
std::ostringstream oss;
@@ -2564,7 +2578,6 @@ private:
throw BadRequestException("Invalid or unknown request.");
}
#endif
-
void handleClientWsUpgrade(const Poco::Net::HTTPRequest& request, const std::string& url,
SocketDisposition &disposition)
{
@@ -2662,15 +2675,18 @@ private:
// Users of development versions get just an info when reaching max documents or connections
checkSessionLimitsAndWarnClients();
#endif
+ sendLoadResult(clientSession, true, "");
}
catch (const UnauthorizedRequestException& exc)
{
LOG_ERR("Unauthorized Request while loading session for " << docBroker->getDocKey() << ": " << exc.what());
+ sendLoadResult(clientSession, false, "Unauthorized Request");
const std::string msg = "error: cmd=internal kind=unauthorized";
clientSession->sendMessage(msg);
}
catch (const StorageConnectionException& exc)
{
+ sendLoadResult(clientSession, false, exc.what());
// Alert user about failed load
const std::string msg = "error: cmd=storage kind=loadfailed";
clientSession->sendMessage(msg);
@@ -2678,6 +2694,7 @@ private:
catch (const std::exception& exc)
{
LOG_ERR("Error while loading : " << exc.what());
+ sendLoadResult(clientSession, false, exc.what());
}
});
});
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 9f195cb9d..f64a725a4 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -655,8 +655,11 @@ std::string WopiStorage::loadStorageFileToLocal(const Authorization& auth)
if (response.getStatus() != Poco::Net::HTTPResponse::HTTP_OK)
{
- LOG_ERR("WOPI::GetFile failed with " << response.getStatus() << ' ' << response.getReason());
- throw StorageConnectionException("WOPI::GetFile failed");
+ std::ostringstream oss;
+ Poco::StreamCopier::copyStream(rs, oss);
+ std::string responseString = oss.str();
+ LOG_ERR("WOPI::GetFile failed with " << response.getStatus() << ' ' << responseString);
+ throw StorageConnectionException("WOPI::GetFile failed: " + responseString);
}
else // Successful
{
More information about the Libreoffice-commits
mailing list