Fix: Allow special charaters in node titles #59
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of restricting the user to allowed file names, we should also allow special characters in note titles.
I think, the most restrictions come from windows file systems (see below).
I had two possible solutions in mind:
The quickest solution and the one which is picked here is to use URL encoding. However, we do not encode every character but only special characters which are prohibited in file names (<, >, :, ", /, , |, ?, *) and the escape character (%). For decoding, a full URL decode is used. This is safe as long as all notes are created by
note.py
or any other tool which encodes file names the same way.Another solution will be to store the full title somewhere else in the note's directory. Maybe some
metadata.yml
. We should try to keep the directory name an title in sync, but we are not forced to. This solution will take more effort but themetadata.yml
might come in handy later, when other meta data should be stored (e.g. tags).@hmlampe: Please let me know, which solution you prefer.
References: