mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +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 {
|
String get filePath {
|
||||||
_filePath ??= p.join(parent.folderPath, getFileName(this));
|
_filePath ??= p.join(parent.folderPath, getFileName(this));
|
||||||
|
if (!_filePath.toLowerCase().endsWith('.md')) {
|
||||||
|
_filePath += '.md';
|
||||||
|
}
|
||||||
return _filePath;
|
return _filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,15 +15,15 @@ String getFileName(Note note) {
|
|||||||
if (note.title.isNotEmpty) {
|
if (note.title.isNotEmpty) {
|
||||||
return buildTitleFileName(note.parent.folderPath, note.title);
|
return buildTitleFileName(note.parent.folderPath, note.title);
|
||||||
} else {
|
} else {
|
||||||
return toSimpleDateTime(date) + ".md";
|
return toSimpleDateTime(date);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NoteFileNameFormat.Iso8601:
|
case NoteFileNameFormat.Iso8601:
|
||||||
return toIso8601(date) + ".md";
|
return toIso8601(date);
|
||||||
case NoteFileNameFormat.Iso8601WithTimeZone:
|
case NoteFileNameFormat.Iso8601WithTimeZone:
|
||||||
return toIso8601WithTimezone(date) + ".md";
|
return toIso8601WithTimezone(date);
|
||||||
case NoteFileNameFormat.Iso8601WithTimeZoneWithoutColon:
|
case NoteFileNameFormat.Iso8601WithTimeZoneWithoutColon:
|
||||||
return toIso8601WithTimezone(date).replaceAll(":", "_") + ".md";
|
return toIso8601WithTimezone(date).replaceAll(":", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
return date.toString();
|
return date.toString();
|
||||||
|
Reference in New Issue
Block a user