mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 01:45:55 +08:00
Ensure Note's fileName always ends with a .md
We were missing it in some cases :( Fixes #135
This commit is contained in:
@ -59,6 +59,9 @@ class Note with NotesNotifier {
|
||||
|
||||
String get filePath {
|
||||
_filePath ??= p.join(parent.folderPath, getFileName(this));
|
||||
if (!_filePath.toLowerCase().endsWith('.md')) {
|
||||
_filePath += '.md';
|
||||
}
|
||||
return _filePath;
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,15 @@ String getFileName(Note note) {
|
||||
if (note.title.isNotEmpty) {
|
||||
return buildTitleFileName(note.parent.folderPath, note.title);
|
||||
} else {
|
||||
return toSimpleDateTime(date) + ".md";
|
||||
return toSimpleDateTime(date);
|
||||
}
|
||||
break;
|
||||
case NoteFileNameFormat.Iso8601:
|
||||
return toIso8601(date) + ".md";
|
||||
return toIso8601(date);
|
||||
case NoteFileNameFormat.Iso8601WithTimeZone:
|
||||
return toIso8601WithTimezone(date) + ".md";
|
||||
return toIso8601WithTimezone(date);
|
||||
case NoteFileNameFormat.Iso8601WithTimeZoneWithoutColon:
|
||||
return toIso8601WithTimezone(date).replaceAll(":", "_") + ".md";
|
||||
return toIso8601WithTimezone(date).replaceAll(":", "_");
|
||||
}
|
||||
|
||||
return date.toString();
|
||||
|
Reference in New Issue
Block a user