diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-02-21 20:41:47 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-02-22 10:29:17 +0100 |
commit | 43c709166ef5aa6d6c595d8a6bbe7c1f177da3d8 (patch) | |
tree | 3d79e969bc0148533d9c2ee3c15bd72b6d2099de | |
parent | 7714ed1ee217f54fe6eb79493b20d366774d4f0a (diff) |
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@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | wsd/ClientSession.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 94f9f44ee..b307e2e6b 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); |