Merge pull request #798 from hedgedoc/fix/default-note-freeurl

Fix note creation in FreeURL-mode does not apply default template
This commit is contained in:
David Mehren 2021-02-07 16:04:14 +01:00 committed by GitHub
commit 082939ac9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,11 +93,12 @@ module.exports = function (sequelize, DataTypes) {
if (!note.content) { if (!note.content) {
var body = null var body = null
let filePath = null let filePath = null
if (!note.alias) { if (note.alias) {
filePath = config.defaultNotePath
} else {
filePath = path.join(config.docsPath, note.alias + '.md') filePath = path.join(config.docsPath, note.alias + '.md')
} }
if (!filePath || !Note.checkFileExist(filePath)) {
filePath = config.defaultNotePath
}
if (Note.checkFileExist(filePath)) { if (Note.checkFileExist(filePath)) {
var fsCreatedTime = moment(fs.statSync(filePath).ctime) var fsCreatedTime = moment(fs.statSync(filePath).ctime)
body = fs.readFileSync(filePath, 'utf8') body = fs.readFileSync(filePath, 'utf8')