Commit Graph

17 Commits (master)

Author SHA1 Message Date
Ashod Nakashian b1f0834ac4 wsd: do not upload unmodified document
When always_save_on_exit=true we should
still not upload the document when it
isn't modified.

In this case, because we now always
save the document (forced) when
always_save_on_exit=true, and because
saving always generates a new file on
disk, with a new timestamp, we couldn't
detect that there are no modifications.

We now still force save, but ask Core
to skip it if the document is unmodified.

This is safe since we now always issue
the save, but rely on Core to do the
right thing. When the document is saved,
we do the normal upload as in that case
we know we have a new version of the
document, which must be uploaded.

Worth noting that the closedocument
command doesn't trigger the same path.
To reproduce the issue, we need a new
test that disconnects, instead of the
graceful closedocument command.

Change-Id: Iaa4e0363ed2eca124f2d1943393e65c0c187aa18
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-04 05:29:32 -05:00
Ashod Nakashian 7f2f946aec wsd: logging and cosmetics
Change-Id: I777db7d1879e84f341f11a90fce7abf8241f5ced
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-04 05:29:32 -05:00
Ashod Nakashian 7a327c337b wsd: force autoSave on always_save_on_exit
This forces autoSave when always_save_on_exit
is true. This is needed so we can guarantee
that we don't have modification and that
we upload if there has every been one.
The latter case is checked in
DocumentBroker::needToUploadToStorage(),
which is called from
DocumentBroker::checkAndUploadToStorage().

A new test reproduces the issue and defends
the fix.

Change-Id: I0b2105a57cfd7049ba7b1f63e62a700fdc3744c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-02 08:17:01 -05:00
Michael Meeks 7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Ashod Nakashian 0a969e5006 wsd: better modification detection after saving
And now UnitSaveOnExitUnmodified verifies that
we do not unnecessarily upload unmodified
documents because always-save-on-exit is set.

Always-save-on-exit is meaningful only when there
are modifications. Otherwise, we create identical
copies as separate revisions.

Change-Id: I933069d31d3d273c41734b58e0849680566e591a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian fc80fb66bf wsd: test: refactor assertGetFileRequest into the handler
Change-Id: I4a1a17bac9694f92ffab49d1c9143bab83f22835
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-20 03:55:19 -04:00
Ashod Nakashian 318f3f6eb8 wsd: more accurate possible-modification flagging
This improves the flagging of possible-modification
in cases where there might be a race between the
arrival of the ModifiedStatus flag from Core
and the closing of the document. This can happen,
for example, when the user makes an edit and
immediately closes the document. In these cases
we want to be able to assume modification based
on the last activity from the user that may have
modified the document.

The issue this patch fixes is that we were too
aggressive in our assumption of modification,
because it was better to be wrong and try to
save rather than not. However, this also set
the IsModifiedByUser header to the PutFile
request when uploading the document to storage,
which was not accurate or acceptable.

Change-Id: I84228bfbb92f688d303568027171df3686d2cd2b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-02-07 14:36:51 +01:00
Ashod Nakashian fac3f05859 wsd: test: add UnitSaveOnExitUnmodified
This tests the headers when always_save_on_exit
is set.

Change-Id: I1aa2d11db79f525f2d94ced8702514d5b3535fc8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian 2e48738dc8 wsd: fix always_save_on_exit
This fixes the handling of the
always_save_on_exit=true setting.

Change-Id: I6993030c2af7fa080c8421c5cb4fa7cb9ea3eb9b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian 8e2c238ee9 wsd: test: better UnitWOPISaveOnExit
Improves stability by closing the document
only after uploading has finished.

Change-Id: I20927a5d009998d9d7a25c3309fef02a45077c70
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-29 08:53:31 -05:00
Ashod Nakashian 20332f4078 wsd: only users can force uploading
Forced uploading is used to overwrite the
file in storage. This is useful when there
is a conflict. Only the user can decide to
do (or not do) that. As such, no auto-save
or any other case should force an upload.

The issue is that we can clobber a conflicted
version in storage by accident. Forced upload
was used for always_exit_on_save=true setting,
which wasn't really needed as the feature isn't
to forcefully upload, rather to just save and
upload as necessary.

Change-Id: Ie46f38f76392493fe8f8112f05953899963da99b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-01-27 08:44:53 -05:00
Ashod Nakashian 02f2860847 wsd: test: assert correct wopi GetFile and PutFile
Change-Id: I7e08d87eb382d67aed3ffaff32230e2c08d8c828
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Ashod Nakashian b90638d436 wsd: test: ingest the doc content only when PutFile succeeds
Change-Id: I4d4accba34c2883b1cb4d6d43a40c89d2eb8a48f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Ashod Nakashian 6b0d550b5b wsd: test: validate the number of wopi requests
We track the number of wopi requests done
during tests and compare with the expected,
in each test scenario. This ensures we don't
miss any expected/required wopi operation,
but also that we don't do more than the
necessary minimum.

Change-Id: I2474f54987a6a12c396b6c0566324772ee3300e6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Ashod Nakashian 319685d858 wsd: test: minor cleanup of conflict tests
Change-Id: Ib56aa5fa609b76ce450fdea21f955b2130600a6a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-03-09 19:24:40 -05:00
Ashod Nakashian 39e29cf3dc wsd: test: remove inherited logic from UnitWOPIDocumentConflict
Change-Id: I433d0aaa661ad607fc029a52989d806e8364d037
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Ashod Nakashian 203a58f6d8 wsd: test: add SaveOnExit test
Refactor UnitWOPIDocumentConflict.cpp into
WOPIUploadConflictCommon.hpp and reuse for both
DocumentConflict and SaveOnExit tests.

Change-Id: I54ec1e37e5e9c6298b12a2b2e596363683fb2e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-08 20:46:01 -05:00