diff --git a/lib/note/index.js b/lib/note/index.js index 47698204..d90371fe 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -94,14 +94,14 @@ async function showPublishNote (req, res) { includeUser: true }) - if (!canViewNote(note, req.isAuthenticated(), req.user ? req.user.id : null)) { - return errorForbidden(req) - } - if (!note) { return errorNotFound(res) } + if (!canViewNote(note, req.isAuthenticated(), req.user ? req.user.id : null)) { + return errorForbidden(req) + } + if ((note.alias && shortid !== note.alias) || (!note.alias && shortid !== note.shortid)) { return res.redirect(config.serverURL + '/s/' + (note.alias || note.shortid)) }