kit/ChildSession.cpp |    4 ----
 kit/Kit.cpp          |    2 ++
 wsd/protocol.txt     |    7 +++++++
 3 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 1783c86765f60ac481e046c915581dfdd0eb6615
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Thu Jul 16 22:00:40 2020 +0530
Commit:     Aron Budea <aron.bu...@collabora.com>
CommitDate: Fri Jul 24 07:27:27 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 <ashnak...@gmail.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    (cherry picked from commit 22359767d6748e0447eea32d792c83b10b36e5b1)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99290
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index b11763a05..b0aa69701 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -213,10 +213,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 743251fef..3e4944740 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1743,8 +1743,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
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to