vrtmrz / obsidian-livesync

MIT License
3.96k stars 134 forks source link

Documents with question mark in title won't be synced #300

Open ThomasSteinbach opened 9 months ago

ThomasSteinbach commented 9 months ago

Abstract

Documents with question mark in title won't be synced. This may be affect further special characters.

Expected behaviour

Actually happened

Reproducing procedure

  1. Setup at least two devices with obsidian livesync
  2. Create a new document with a '?' in the title (e.g. 'test?')
  3. wait for the document on the other devices

Other information, insights and intuition.

vrtmrz commented 8 months ago

Thank you for opening the issue, and filling in the form! I regret to say this, however, this is the specification as designed. Owing to a mind that I could not decide how to handle file names when files are synchronised to a Windows device. (Maybe Android with an SD card is too). If you have any ideas for bi-directional name conversion, please let me know! I hope to address it.

ThomasSteinbach commented 8 months ago

Interesting. You're right. Even on Android question marks aren't allowed.

Suggstion 1: Encode the file name to base64 and decode the file names on the target system, where possible. Where not possible (e.g. win/android), keep the base64 encoded string as file name. This would lead to "strange" file names on some systems. However at least files were synced. This requires to check, if a file name is already in base64.

Suggestion 2: Warn if a file name contains incompatible chars. The obsidian android app tells you which characters are not allowed, when you use them in the title.

vrtmrz commented 8 months ago

Thank you for your suggestions! Actually, No. 1 is already implemented as part of path obfuscation. What I am concerned about is how a file xxxx?.md on iOS can be saved on Android. If the file is saved as xxxx%3F.md on Android, we might not be able to synchronise a file actually named xxxx%3F.md as is.

Hence, your second suggestion might be very useful: If a file cannot be synchronised with Self-hosted LiveSync, show a warning message around the filename. I will address it in a while!