summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Mehren2021-02-07 16:04:14 +0100
committerGitHub2021-02-07 16:04:14 +0100
commit082939ac9a55c1418c509aeece4080bd06ca55eb (patch)
treea2f5ac919a927810fa51071ffd3911c45fca2e31 /lib
parent05e9b5ab8ffa168e4194f91d2a107667600778b3 (diff)
parent3808c08c2db3641b0928f6dc743feb3a31bcbf43 (diff)
Merge pull request #798 from hedgedoc/fix/default-note-freeurl
Fix note creation in FreeURL-mode does not apply default template
Diffstat (limited to 'lib')
-rw-r--r--lib/models/note.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/models/note.js b/lib/models/note.js
index 9fe02359..7418c47e 100644
--- a/lib/models/note.js
+++ b/lib/models/note.js
@@ -93,11 +93,12 @@ module.exports = function (sequelize, DataTypes) {
if (!note.content) {
var body = null
let filePath = null
- if (!note.alias) {
- filePath = config.defaultNotePath
- } else {
+ if (note.alias) {
filePath = path.join(config.docsPath, note.alias + '.md')
}
+ if (!filePath || !Note.checkFileExist(filePath)) {
+ filePath = config.defaultNotePath
+ }
if (Note.checkFileExist(filePath)) {
var fsCreatedTime = moment(fs.statSync(filePath).ctime)
body = fs.readFileSync(filePath, 'utf8')