test/integration-http-server.cpp | 6 +++++- wsd/ClientSession.cpp | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-)
New commits: commit 454bb7613aae8961ae81d8fd5e66229ff360bde8 Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Oct 26 12:12:13 2017 +0200 Fix convert-to after the Save As work. Change-Id: I1871dd8331367798ee42b2ca35505847b43b639d Reviewed-on: https://gerrit.libreoffice.org/43881 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/test/integration-http-server.cpp b/test/integration-http-server.cpp index 71786205..f93874ff 100644 --- a/test/integration-http-server.cpp +++ b/test/integration-http-server.cpp @@ -239,7 +239,11 @@ void HTTPServerTest::testConvertTo() form.set("format", "txt"); form.addPart("data", new Poco::Net::FilePartSource(srcPath)); form.prepareSubmit(request); - // If this results in a Poco::Net::ConnectionRefusedException, loolwsd is not running. + + // FIXME From some reason we are getting Poco::Net::ConnectionRefusedException + // What happens is that the file is just partially transferred - + // ConvertToPartHandler::handlePart() gets just some 3.6k bytes; no idea + // why yet form.write(session->sendRequest(request)); Poco::Net::HTTPResponse response; diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index e4e41cae..60364a2a 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -618,17 +618,26 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt } else if (tokens.size() == 3 && tokens[0] == "saveas:") { + bool isConvertTo = static_cast<bool>(_saveAsSocket); + std::string encodedURL; if (!getTokenString(tokens[1], "url", encodedURL)) { LOG_ERR("Bad syntax for: " << firstLine); - return false; + // we must not return early with convert-to so that we clean up + // the session + if (!isConvertTo) + { + sendTextFrame("error: cmd=saveas kind=syntax"); + return false; + } } std::string encodedWopiFilename; - if (!getTokenString(tokens[2], "filename", encodedWopiFilename)) + if (!isConvertTo && !getTokenString(tokens[2], "filename", encodedWopiFilename)) { LOG_ERR("Bad syntax for: " << firstLine); + sendTextFrame("error: cmd=saveas kind=syntax"); return false; } @@ -660,7 +669,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt LOG_TRC("Save-as URL: " << resultURL.toString()); - if (!_saveAsSocket) + if (!isConvertTo) { // Normal SaveAs - save to Storage and log result. if (resultURL.getScheme() == "file" && !resultURL.getPath().empty()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits