Sanitize the filename derived from the note's title

Not all characters are supported on all platforms. Additionally, we
don't want it to have the path seperator.

Fixes #132
This commit is contained in:
Vishesh Handa
2020-05-13 12:09:54 +02:00
parent 31e3e8c806
commit 132b3ddcb8

View File

@ -30,6 +30,9 @@ String getFileName(Note note) {
}
String buildTitleFileName(String parentDir, String title) {
// Sanitize the title - these characters are not allowed in Windows
title = title.replaceAll(RegExp(r'[/<\>":|?*]'), '_');
var fileName = title + ".md";
var fullPath = p.join(parentDir, fileName);
var file = File(fullPath);