diff --git a/Backend/routes/recipes.js b/Backend/routes/recipes.js index ae9b58a58..c248be271 100644 --- a/Backend/routes/recipes.js +++ b/Backend/routes/recipes.js @@ -27,9 +27,7 @@ const legacyImageHandler = async (req, res, next) => { SubscriptionsService.CAPABILITIES.HIGH_RES_IMAGES ); - req.body.imageIds = req.body.imageIds || []; - - const imageIds = req.body.imageIds; + const imageIds = req.body.imageIds || []; await UtilService.upload('image', req, res); if (req.file) { const uploadedFile = req.file; @@ -56,6 +54,8 @@ const legacyImageHandler = async (req, res, next) => { imageIds.unshift(newImage.id); } + req.body.imageIds = imageIds; + next(); };