Fix for empty page contents crashing parser

This commit is contained in:
NGPixel
2017-04-06 20:55:45 -04:00
parent d7a9b95850
commit 956d3aca08
3 changed files with 21 additions and 6 deletions

View File

@@ -285,6 +285,9 @@ module.exports = {
includeMarkdown: true,
includeParentInfo: true,
cache: true
}).catch(err => {
winston.error(err)
return err
}).then((pageData) => {
return {
entryPath,
@@ -292,6 +295,9 @@ module.exports = {
parent: pageData.parent || {},
text: mark.removeMarkdown(pageData.markdown)
}
}).catch(err => {
winston.error(err)
return err
}).then((content) => {
return db.Entry.findOneAndUpdate({
_id: content.entryPath
@@ -304,6 +310,9 @@ module.exports = {
new: true,
upsert: true
})
}).catch(err => {
winston.error(err)
return err
})
},