Add HTTP 404 error on non-existent note downloads

When FreeURL mode is enabled and you called the /download route, the note was created and the user redirected to the blank note.
This is caused because the findNote method automatically creates a note when no existing one is found.
This commit adds a new parameter to the findNote method which allows to disable this behaviour. In that case a HTTP 404 error will be returned.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2021-02-17 22:02:47 +01:00
parent 929ceca20f
commit 7e597226ec
No known key found for this signature in database
GPG key ID: DB99ADDDC5C0AF82
2 changed files with 6 additions and 3 deletions

View file

@ -119,7 +119,7 @@ exports.doAction = function (req, res, next) {
default:
return res.redirect(config.serverURL + '/' + noteId)
}
})
}, null, false)
}
exports.downloadMarkdown = function (req, res, note) {