joplin
joplin copied to clipboard
Add a file in sync target to warn user that they shouldn't open any file
Opening any file, even without changing it, on a Nextcloud sync target is going to corrupt it (See https://github.com/laurent22/joplin/issues/9887).
To try to prevent the user from doing this we would like to add a file that appears at the top of the list, named something very visible such _⚠️_IMPORTANT_READ_FIRST_⚠️_.md
. It would be automatically created when the sync target is initialised and should also be added to existing sync targets. It contains some information as to why these files should not be opened.
Edit: The difficulty with implementing this is that we don't want to have a check if the file exist on each sync. Traditionally the way to add a file to a sync target is to do a sync target migration but due to the complexity of it we avoid doing that now. Maybe a way would to be to check for example once a day if the file is there, and add it if it's not.
Hi, I've been working on this and managed to figure out how to add a file to Nextcloud targets. However, I needed some clarifications.
Here is the change I made: https://github.com/RadCod3/joplin/commit/59167b358a8adb38c5309b72088530fafa737e5f
This modification enables the addition of a file to a Nextcloud target by checking if it has the warning file and adding it if it doesn't. I observed that when connecting a different Joplin client to the sync remote, the console shows the delta algorithm finding 4 new items. These items in the Nextcloud include the warning file, one for a note, one for a notebook (?), and the info.json file. The sync fetches all four of these files, but the warning file doesn't appear in the notes section of the Joplin app. I believe this is what we need, but I'm curious as to why it was filtered. Could it be related to the file not having a footer with id, parent_id, etc.?
Regarding what to add to the warning file, how does the following look?
THIS WAS CREATED AUTOMATICALLY BY JOPLIN.
# **PLEASE DO NOT EDIT ANY FILES CREATED BY JOPLIN USING THE NEXTCLOUD TEXT EDITOR AS IT CORRUPTS THE FILES.**
FOR MORE INFORMATION ABOUT THIS ISSUE, PLEASE REFER TO THE FOLLOWING LINK:
[ Nextcloud sync: Very easy to cause data corruption with Nextcloud's rich text editor #9887 ]
(https://github.com/laurent22/joplin/issues/9887)