[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3-1' - wsd/ClientSession.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Feb 22 09:29:35 UTC 2018


 wsd/ClientSession.cpp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 43c709166ef5aa6d6c595d8a6bbe7c1f177da3d8
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Feb 21 20:41:47 2018 -0500

    wsd: always avoid saving readonly files
    
    Otherwise saving is bound to fail, causing other
    errors, which is nonsensical since there is nothing
    to save to begin with.
    
    Change-Id: Icb65a4a3b277b3175aadbe5107b294b24a399e7b
    Reviewed-on: https://gerrit.libreoffice.org/50153
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 94f9f44e..b307e2e6 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -237,11 +237,12 @@ bool ClientSession::_handleInput(const char *buffer, int length)
     else if (tokens[0] == "save")
     {
         int dontTerminateEdit = 1;
-        int dontSaveIfUnmodified = 1;
         if (tokens.size() > 1)
             getTokenInteger(tokens[1], "dontTerminateEdit", dontTerminateEdit);
 
-        if (tokens.size() > 2)
+        // Don't save unmodified docs by default, or when read-only.
+        int dontSaveIfUnmodified = 1;
+        if (!isReadOnly() && tokens.size() > 2)
             getTokenInteger(tokens[2], "dontSaveIfUnmodified", dontSaveIfUnmodified);
 
         docBroker->sendUnoSave(getId(), dontTerminateEdit != 0, dontSaveIfUnmodified != 0);


More information about the Libreoffice-commits mailing list