[Libreoffice-commits] online.git: Branch 'libreoffice-6-2' - wsd/ClientSession.cpp
Eduard Ardeleanu (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 25 14:55:17 UTC 2019
wsd/ClientSession.cpp | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
New commits:
commit 5fe0a1455c95e5e23699801b951a000e5f8439e6
Author: Eduard Ardeleanu <eduard-andrei.ardeleanu at 1and1.ro>
AuthorDate: Fri May 24 09:57:06 2019 +0300
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Jul 25 16:54:57 2019 +0200
detecting password protected files on convertTo
Fail-fast when a file cannot be converted, using convertTo REST API, if the file is password protected and the password wasn't received.
Change-Id: I32d807bcecbbe72a38a70fec74caf13638803e1d
Reviewed-on: https://gerrit.libreoffice.org/72891
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/76330
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index a1e6c9319..8854a8bd8 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -680,6 +680,9 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
return false;
}
+
+ const bool isConvertTo = static_cast<bool>(_saveAsSocket);
+
#ifndef MOBILEAPP
LOOLWSD::dumpOutgoingTrace(docBroker->getJailId(), getId(), firstLine);
#endif
@@ -736,13 +739,30 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
errorKind == "passwordrequired:to-modify" ||
errorKind == "wrongpassword")
{
- forwardToClient(payload);
+ if (isConvertTo)
+ {
+ Poco::Net::HTTPResponse response;
+ response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_UNAUTHORIZED);
+ response.set("X-ERROR-KIND", errorKind);
+ _saveAsSocket->send(response);
+
+ // Conversion failed, cleanup fake session.
+ LOG_TRC("Removing save-as ClientSession after conversion error.");
+ // Remove us.
+ docBroker->removeSession(getId());
+ // Now terminate.
+ docBroker->stop("Aborting saveas handler.");
+ }
+ else
+ {
+ forwardToClient(payload);
+ }
return false;
}
}
else
{
- LOG_WRN("Other than load failure: " << errorKind);
+ LOG_WRN(errorCommand << " error failure: " << errorKind);
}
}
}
@@ -774,7 +794,6 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
#ifndef MOBILEAPP
else if (tokens.size() == 3 && tokens[0] == "saveas:")
{
- bool isConvertTo = static_cast<bool>(_saveAsSocket);
std::string encodedURL;
if (!getTokenString(tokens[1], "url", encodedURL))
More information about the Libreoffice-commits
mailing list