From 6b8db74a2b51a17cbbac378ca99c0429f05f7aa3 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Mon, 5 Dec 2022 22:31:56 -0600 Subject: [PATCH] add authors length check and account elvis operator --- server/homebrew.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index e5d304b69..393c9793d 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -43,7 +43,7 @@ const getBrew = (accessType, fetchGoogle = true)=>{ } }); stub = stub?.toObject(); - if(accessType === 'edit' && stub?.authors && !stub?.authors.includes(req.account.username)) { + if(accessType === 'edit' && stub?.authors?.length > 0 && !stub?.authors.includes(req.account?.username)) { throw 'Current logged in user does not have access to this brew.'; }