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
|
includeUser: true
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!canViewNote(note, req.isAuthenticated(), req.user ? req.user.id : null)) {
|
|
||||||
return errorForbidden(req)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
return errorNotFound(res)
|
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)) {
|
if ((note.alias && shortid !== note.alias) || (!note.alias && shortid !== note.shortid)) {
|
||||||
return res.redirect(config.serverURL + '/s/' + (note.alias || note.shortid))
|
return res.redirect(config.serverURL + '/s/' + (note.alias || note.shortid))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue