From cdadbb5df46afa7fd0890baa08b73de29e111f36 Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Tue, 24 Nov 2020 00:32:49 +0100 Subject: [PATCH] fix: a few issues with old node version, again --- routes/api/tracks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/api/tracks.js b/routes/api/tracks.js index 6774e64..807c66e 100644 --- a/routes/api/tracks.js +++ b/routes/api/tracks.js @@ -335,7 +335,7 @@ router.get( req.track.populate('author').execPopulate(), ]); - if (!req.track.visible && req.track.author._id.toString() !== req.payload?.id?.toString()) { + if (!req.track.visible && (!req.payload || req.track.author._id.toString() !== req.payload.id.toString())) { return res.sendStatus(403); } @@ -365,7 +365,7 @@ router.put( req.track.description = body.description; } - if (body && body.trim()) { + if (body.body && body.body.trim()) { req.track.body = body.body.trim(); let trackData = await TrackData.findById(req.track.trackData);