mirror of https://github.com/status-im/codimd.git
fix: page broken when shortId doesn't exists
Signed-off-by: BoHong Li <raccoon@hackmd.io>
This commit is contained in:
parent
05dd6eb739
commit
db615e5111
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue