0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Fix crash when not logged in

If not logged in, brew.authors doesn't exist, so visiting the share page crashes.
This commit is contained in:
Trevor Buckner
2023-10-13 23:44:34 -04:00
parent 1c71ff0945
commit 3ac0ac7568

View File

@@ -328,7 +328,7 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
};
// increase visitor view count, do not include visits by author(s)
if(brew.authors.includes(req.account.username) === false){
if(!brew.authors.includes(req.account?.username)){
if(req.params.id.length > 12 && !brew._id) {
const googleId = brew.googleId;
const shareId = brew.shareId;