kit/ChildSession.cpp | 4 ---- kit/Kit.cpp | 2 ++ wsd/protocol.txt | 7 +++++++ 3 files changed, 9 insertions(+), 4 deletions(-)
New commits: commit 22359767d6748e0447eea32d792c83b10b36e5b1 Author: Pranam Lashkari <[email protected]> AuthorDate: Thu Jul 16 22:00:40 2020 +0530 Commit: Pranam Lashkari <[email protected]> CommitDate: Thu Jul 16 19:31:31 2020 +0200 tdf#129296 leaflet: Password protected document load failing Do not send faileddocloading error if it is because of password. When the document is password protected, we send to the client both passwordrequired and faileddocloading. These two are handled differently. While the first prompts the user for password input, the second internally flags fatal error and shows an error message that the document may be corrupted etc. The end result is that the document is not loaded and displayed when the user submits a correct password. To reset the fatal error one has to reload, which is unhelpful when we need to provide a password. This patch makes sure that we only send one error message to the client. If a password is required, it already implies that the document didn't load, and that with the proper password we should try again. Similarly for when the password given is wrong. However, if loading fails and it isn't a password-related failure, faileddocloading error is returned and in this case the client handles it as a final error (that requires reloading to retry). Change-Id: I383418fd40b6e0749b20af0ef8dc40f391a05559 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98676 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index df87c94af..e34de28c2 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -210,10 +210,6 @@ bool ChildSession::_handleInput(const char *buffer, int length) } _isDocLoaded = loadDocument(buffer, length, tokens); - if (!_isDocLoaded) - { - sendTextFrameAndLogError("error: cmd=load kind=faileddocloading"); - } LOG_TRC("isDocLoaded state after loadDocument: " << _isDocLoaded << '.'); return _isDocLoaded; diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 284e552f3..123a87e66 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1201,8 +1201,10 @@ private: LOG_INF("Wrong password for password-protected document [" << uriAnonym << "]."); session->sendTextFrameAndLogError("error: cmd=load kind=wrongpassword"); } + return nullptr; } + session->sendTextFrameAndLogError("error: cmd=load kind=faileddocloading"); return nullptr; } diff --git a/wsd/protocol.txt b/wsd/protocol.txt index 927348bff..0cfacf2ed 100644 --- a/wsd/protocol.txt +++ b/wsd/protocol.txt @@ -29,6 +29,13 @@ code here and there that assumes that parameters are in a specific order anyway, thus losing the benefits of the named parameters. Oh well. +When the document is password protected, it already implies that the +document didn't load, and that with the proper password we should try +again. Similarly for when the password given is wrong. However, if +loading fails and it isn't a password-related failure, +faileddocloading error is returned and in this case the client handles +it as a final error (that requires reloading to retry). + client -> server ================ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
