text icon indicating copy to clipboard operation
text copied to clipboard

[Bug]: Shared text file is not up-to-date with saved file

Open niowniow opened this issue 2 years ago • 5 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

Offline edits of a shared text file (shared as non-editable) which are then synced are not updated in the in-browser view of the shared file

Steps to reproduce

  1. create a text file in nextcloud
  2. edit it with the in built-in text editor
  3. share the next file via public link without allowing editing
  4. sync the file using the desktop client
  5. edit synced file offline
  6. sync again
  7. the shared document does not show the changes
  8. open the file in the nextcloud text editor The warning appears: image and I can choose "use current version" or "use saved version".
  9. Clicking "use saved version" updates the shared file

Expected behavior

Any changes to the file saved in the nextcloud are reflected in the shared file. The saved text file (i.e. the file that is in the nextcloud filesystem) is shown in the shared in-browser text file view, not any other version that may be in some cache of the nextcloud text editor (or somewhere else).

Installation method

Other

Operating system

Other

PHP engine version

Other

Web server

Other

Database engine version

No response

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

  • [ ] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

No response

List of activated Apps

I don't have access to the command-line

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

hosted by webo.hosting

niowniow avatar May 12 '22 12:05 niowniow

Dear @niowniow, thanks for your report. I was able to reproduce the behaviour that you describe.

The problem is that the editor session of the shared file is not cleaned up when closing the tab. So when opening the share link again fast enough (with the file having been altered via file sync in the meantime), the version from the session and the file as stored in Nextcloud differ and the conflict dialog is displayed.

We definitely should improve user experience here. I wonder whether we could detect that the file in session had been written to the filesystem and thus any subsequent changes are legit newer versions of the file.

@max-nextcloud as you're working on this field at the moment.

mejo- avatar Nov 01 '22 13:11 mejo-

Code wise this seems to be related to the check to only reset the document when no active sessions are there in https://github.com/nextcloud/text/blob/f5a34ceef75ce5e234bc8275b84ada6ca22c563e/lib/Service/ApiService.php#L93-L97

juliushaertl avatar Nov 02 '22 11:11 juliushaertl

I have reproduced the same bug.

s4069b avatar Oct 10 '23 06:10 s4069b

I have reproduced the same bug.

Thanks. Just hit the thumbs-up emoji at the bottom of the original description unless you have details to add.

meonkeys avatar Oct 10 '23 18:10 meonkeys

The same behavior is observable also when changing a file with the Notes app, with the same message being issued by the Text Editor afterwards: "The document has been changed outside of the file editor. The changes cannot be applied."