[Libreoffice-commits] online.git: wsd/ClientSession.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Fri Feb 23 15:55:20 UTC 2018


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

New commits:
commit 7c2c0062e34c7da6686046e5e9392501353657ec
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/50148
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 47e2f631..12f30a8e 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