mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Fix errors constant in note/actions.js
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
f78540c3fb
commit
9d938c334a
1 changed files with 7 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
||||||
const models = require('../../models')
|
const models = require('../../models')
|
||||||
const logger = require('../../logger')
|
const logger = require('../../logger')
|
||||||
const config = require('../../config')
|
const config = require('../../config')
|
||||||
const error = require('../../errors')
|
const errors = require('../../errors')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const shortId = require('shortid')
|
const shortId = require('shortid')
|
||||||
const markdownpdf = require('markdown-pdf')
|
const markdownpdf = require('markdown-pdf')
|
||||||
|
@ -34,7 +34,7 @@ exports.doAction = function (req, res, next) {
|
||||||
actionPDF(req, res, note)
|
actionPDF(req, res, note)
|
||||||
} else {
|
} else {
|
||||||
logger.error('PDF export failed: Disabled by config. Set "allowPDFExport: true" to enable. Check the documentation for details')
|
logger.error('PDF export failed: Disabled by config. Set "allowPDFExport: true" to enable. Check the documentation for details')
|
||||||
error.errorForbidden(res)
|
errors.errorForbidden(res)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'gist':
|
case 'gist':
|
||||||
|
@ -113,7 +113,7 @@ function actionPDF (req, res, note) {
|
||||||
markdownpdf().from.string(content).to(path, function () {
|
markdownpdf().from.string(content).to(path, function () {
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
logger.error('PDF seems to not be generated as expected. File doesn\'t exist: ' + path)
|
logger.error('PDF seems to not be generated as expected. File doesn\'t exist: ' + path)
|
||||||
return error.errorInternalError(res)
|
return errors.errorInternalError(res)
|
||||||
}
|
}
|
||||||
const stream = fs.createReadStream(path)
|
const stream = fs.createReadStream(path)
|
||||||
let filename = title
|
let filename = title
|
||||||
|
@ -148,10 +148,10 @@ function actionRevision (req, res, note) {
|
||||||
models.Revision.getPatchedNoteRevisionByTime(note, time, function (err, content) {
|
models.Revision.getPatchedNoteRevisionByTime(note, time, function (err, content) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
return error.errorInternalError(res)
|
return errors.errorInternalError(res)
|
||||||
}
|
}
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return error.errorNotFound(res)
|
return errors.errorNotFound(res)
|
||||||
}
|
}
|
||||||
res.set({
|
res.set({
|
||||||
'Access-Control-Allow-Origin': '*', // allow CORS as API
|
'Access-Control-Allow-Origin': '*', // allow CORS as API
|
||||||
|
@ -163,13 +163,13 @@ function actionRevision (req, res, note) {
|
||||||
res.send(content)
|
res.send(content)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return error.errorNotFound(res)
|
return errors.errorNotFound(res)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
models.Revision.getNoteRevisions(note, function (err, data) {
|
models.Revision.getNoteRevisions(note, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
return error.errorInternalError(res)
|
return errors.errorInternalError(res)
|
||||||
}
|
}
|
||||||
const out = {
|
const out = {
|
||||||
revision: data
|
revision: data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue