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@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian
2018-02-21 20:41:47 -05:00
committed by Ashod Nakashian
parent 5befd0803a
commit 7c2c0062e3

View File

@ -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);