diff options
Diffstat (limited to '')
-rw-r--r-- | lib/response.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/response.js b/lib/response.js index a04b7176..2fc5d58d 100644 --- a/lib/response.js +++ b/lib/response.js @@ -188,6 +188,11 @@ function findNote(req, res, callback, include) { function showNote(req, res, next) { findNote(req, res, function (note) { + // force to use note id + var noteId = req.params.noteId; + var id = LZString.compressToBase64(note.id); + if ((note.alias && noteId != note.alias) || (!note.alias && noteId != id)) + return res.redirect(config.serverurl + "/" + (note.alias || id)); return responseHackMD(res, note); }); } @@ -201,6 +206,10 @@ function showPublishNote(req, res, next) { as: "lastchangeuser" }]; findNote(req, res, function (note) { + // force to use short id + var shortid = req.params.shortid; + if ((note.alias && shortid != note.alias) || (!note.alias && shortid != note.shortid)) + return res.redirect(config.serverurl + "/s/" + (note.alias || note.shortid)); note.increment('viewcount').then(function (note) { if (!note) { return response.errorNotFound(res); @@ -519,6 +528,10 @@ function gitlabActionProjects(req, res, note) { function showPublishSlide(req, res, next) { findNote(req, res, function (note) { + // force to use short id + var shortid = req.params.shortid; + if ((note.alias && shortid != note.alias) || (!note.alias && shortid != note.shortid)) + return res.redirect(config.serverurl + "/p/" + (note.alias || note.shortid)); note.increment('viewcount').then(function (note) { if (!note) { return response.errorNotFound(res); |