vrtmrz / obsidian-livesync

MIT License
4.71k stars 151 forks source link

Changing the capitalisation of an existing note causes the file to be destroyed #198

Open StrangePeanut opened 1 year ago

StrangePeanut commented 1 year ago

Scenario 1

Device 1

  1. Create a note called 'example'
  2. Rename the note to 'Example'
  3. The file is destroyed and a WRITE ERROR tooltip is displayed

Device 2

  1. The file is destroyed

Scenario 2

Device 1

  1. Create a note called 'example'
  2. Rename the note to 'example1'
  3. Rename the note to 'Example'
  4. The file is not destroyed

Device 2

  1. The file is destroyed on first launch
  2. The file is restored on relaunch

Configuration

vrtmrz commented 1 year ago

Thank you for reporting! Reproduced! I will address it!

StrangePeanut commented 1 year ago

Thanks so much for your effort. For what it is worth, this issue seems to cause some sort of irreversible local database corruption as well. Deleted WRITE ERROR notes would be recreated upon plug-in reinstall even without an internet connection. Synchronisation would no longer work for any of the WRITE ERROR notes as if they did not exist. The plug-in's 'Discard local database' option did not solve the issue. I had to delete my Obsidian app data directory to get things to work normally on Windows (device 1) again.

vrtmrz commented 1 year ago

At v0.18.4, It should be fixed! Processing orders have been changed, and the logic for #130 has been revoked. I think it is working fine. Presumably, #130 is indirectly fixed by other fixes (the file will be recreated). May I ask you to check the behaviour, please?

StrangePeanut commented 1 year ago

@vrtmrz Thanks so much. I will give it a proper go and let you know asap.

StrangePeanut commented 1 year ago

@vrtmrz the issue seems to be mostly addressed. However, if I add a new note to a directory and then change the capitalisation of this directory on device 1, the following error is returned on device 2 on first launch: DB => STORAGE (create,plain) ERROR, Could not write: tEsT dirEctoRy/tEst nOte.md. If I then relaunch Obsidian on device 2, synchronisation succeeds and no error is displayed. This appears to be the only remaining issue. I hope this helps.

vrtmrz commented 1 year ago

@StrangePeanut Thank you for your testing! I have not reproduced that yet, however, it makes sense.

I feel like there needs to be a more fundamental solution... I will enhance it in a while.

StrangePeanut commented 1 year ago

@vrtmrz No problem. Fortunately it's a bit of an edge case which I think most users would not encounter often. I personally don't really use directories in favour of linking and tagging, so I'm very happy with this update, thank you. Feel free to let me know if you need me to do any further testing.