mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
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:
@ -30,6 +30,9 @@ String getFileName(Note note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String buildTitleFileName(String parentDir, String title) {
|
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 fileName = title + ".md";
|
||||||
var fullPath = p.join(parentDir, fileName);
|
var fullPath = p.join(parentDir, fileName);
|
||||||
var file = File(fullPath);
|
var file = File(fullPath);
|
||||||
|
Reference in New Issue
Block a user