[Bug]: Shared text file is not up-to-date with saved file
⚠️ 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
- create a text file in nextcloud
- edit it with the in built-in text editor
- share the next file via public link without allowing editing
- sync the file using the desktop client
- edit synced file offline
- sync again
- the shared document does not show the changes
- open the file in the nextcloud text editor
The warning appears:
and I can choose "use current version" or "use saved version". - 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
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.
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
I have reproduced the same bug.
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.
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."