Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD files not locked? #76

Closed
rogermartensson opened this issue Jun 16, 2022 · 2 comments
Closed

MD files not locked? #76

rogermartensson opened this issue Jun 16, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@rogermartensson
Copy link

Version: 20.1.0
NC: 22.2.8

Scenario:
Two users where User 1 has shared a folder with User 2.
User 2 creates a text document (.md) in the shared folder and Locks it.
User 1 is able to edit the document.

It is the same result if User 1 creates a file in the folder. User 2 is able to edit the document.

We have installed Only Office and if we use Only Office documents it works.

@superz3n
Copy link

I also encounter this issue where any file that's shared with someone, even though locked by the owner, the other person is able to acces and edit the file.

Nextcloud Hub II (23.0.5)

@danxuliu danxuliu added the bug Something isn't working label Jun 17, 2022
@danxuliu
Copy link
Member

Text files seem to not be locked, although they actually are:

  • Open Files app
  • Create text file
  • Write "Original" in the text file
  • Close the editor
  • Share the file with another user
  • Lock the file
  • In a private browser window, log in as the other user
  • Open Files app
  • Open text editor for the shared file
  • Write "Modified" in the text file
  • Close the editor
  • Download the file

If you check the downloaded file its contents will be Original, as saving the file was prevented by the lock. However, if you open again the file with the text editor the contents will be Modified. Moreover, if you share the file to another user and open the file as that other user the editor contents will also be Modified, but if the file is downloaded again the contents will be Original.

Why?, you may ask. To be able to provide collaborative edition the editor keeps a list of changes done to the file since the last saving and applies them when the editor is opened. If I am not mistaken this is why the editor shows Modified, while the actual file contents are still Original.

To make things more interesting, if the owner of the share opens the text file again with the editor then the changes will be applied by the text editor of that user, and as that user is the one who has the lock the file will be successfully saved with the changes done by the other users.

In Nextcloud 24 locking was implemented for the text editor, so if another user opens a locked file a warning is shown and the file is opened in read only mode, thus preventing the scenario described above.

That required changes in both the Text and Temporary files lock apps, and unfortunately it is very unlikely that it will be backported to any version before Nextcloud 24. If you need the fix you will need to backport it yourself (not recommended) or upgrade to Nextcloud 24 (recommended).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants