Skip to content

Commit db615e5

Browse files
committed
fix: page broken when shortId doesn't exists
Signed-off-by: BoHong Li <[email protected]>
1 parent 05dd6eb commit db615e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/note/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ async function showPublishNote (req, res) {
9494
includeUser: true
9595
})
9696

97-
if (!canViewNote(note, req.isAuthenticated(), req.user ? req.user.id : null)) {
98-
return errorForbidden(req)
99-
}
100-
10197
if (!note) {
10298
return errorNotFound(res)
10399
}
104100

101+
if (!canViewNote(note, req.isAuthenticated(), req.user ? req.user.id : null)) {
102+
return errorForbidden(req)
103+
}
104+
105105
if ((note.alias && shortid !== note.alias) || (!note.alias && shortid !== note.shortid)) {
106106
return res.redirect(config.serverURL + '/s/' + (note.alias || note.shortid))
107107
}

0 commit comments

Comments
 (0)