-
Notifications
You must be signed in to change notification settings - Fork 94
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
File open always triggers save and overwrites last modified date #2337
Comments
Okay, finding the problem was unexpectedly easy, steps to reproduce:
(thats 5 characters, "###" + space + newline)
UPDATE: it has nothing to do with the h3 heading. The root cause is that Nextcloud Text expects the file to end in a paragraph. But, whenever the last text is in a heading (this example), or a bullet list, or enumeration, then the file will be saved again and again. A workaround is to insert a plain paragraph at the end. |
Thank god (sic) i am not the only one with this issue, it melt my mind for 1-2 days of my weekend and now you brought the issue on point! The following is to confirm you findings somehow, but for me i cant reliably work around it, this bugs me in my usecase of using many Text Files :-( i'm having the same issue but i am not aware how to fully reproduce it, it seems this time that when i did paste "some stuff" into the editor, it starts to break and wants to save all the time when opening the file again. So for now i have "somehow" created two files:
File with the problem:
File NOT having the issue:
UPDATE:
And i can confirm that the stuff the editor changes on opening is inserting a new paragraph:
Payload:
|
@githubkoma A workaround is to add a newline and a dot at the end. Or any other character, it doesnt matter. The dot will create a new paragraph and prevent this issue.
Hopefully this will be fixed soon. |
I think this might be related to the TrailingNode plugin that we use, which also mentions that the node is not only visual:
@max-nextcloud I'm wondering if we should rather strip any trailing node during the markdown conversion then to avoid rewriting the file? |
If it was only writing the exact contents back it would be an inconvenience. But just opening some files modifies them immediately, see #2344 . |
Yes... Either that or we could maybe overwrite the toMarkdown function of the trailing node to return an emtpy string. Not sure if that would work though as it would still be a new node. Might be worth a try never the less. |
Pushed a hot fix to #2686 Turned out that the trailing node is actually n to part of the markdown and therefore being the first thing that gets added with the first dispatched transaction (focus). |
Are we sure this is fixed? I upgraded from 24.0.7 to 25.0.1 last night. Since then I'm seeing files marked as modified when I do not make any changes. I assumed it was related to link unfurling / previews. |
@meonkeys do you still have some files that you did not open? |
@max-nextcloud I do, and I tried what you said. But now I can't reproduce this. I just set UPDATE sorry, correction, I think I can reproduce this. Files with zero bare links are correctly left unmodified if I open them and make zero changes. Files with bare links are marked as modified. I think. This is a tricky one and I don't understand how to debug it. |
@meonkeys Could you give an example of a bare link? Something like |
Sure. And sorry, I may have made up the term "bare link". Here's what I mean: bare link: non-bare link: I picked this URL because the target HTML data includes OpenGraph metadata. |
I do not know how backports work. Should this be fixed in v24? And if so, which minor version? (I can say, it does not work with 24.0.6) |
Either 25.0.0 or 24.0.8 (see https://nextcloud.com/changelog/ ) |
Describe the bug
I have multiple files which are saved as soon as they are opened. I am not sure why these files are updated. I tried to reproduce the bug with a new file but the new file was not affected. Maybe something with version history.
However, the network log shows a needless push
"stepType":"replace","from":35,"to":35
Expected behavior
The file should not be written to disk if it has no changes. The unnecessary write destroys the "last changed" date.
Screenshots
Untitled.mp4
Client details:
Server details
Text app version: 3.4.0
Operating system: Arch
Web server: nginx
Database: mysql 8
PHP version: 8
Nextcloud version: 23.0.2 and 23.0.3
Logs
Nextcloud log (data/nextcloud.log)
N/A
Browser log
The text was updated successfully, but these errors were encountered: