From 06cccc10df30b9818cb265f39bc7821f79fde5fe Mon Sep 17 00:00:00 2001 From: LorenzoJokhan Date: Tue, 12 Sep 2023 15:24:46 +0200 Subject: [PATCH] Fixes the sudden saving to submitted when uploading images --- src/middleware/publish-concept.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/middleware/publish-concept.js b/src/middleware/publish-concept.js index 0972cfe4..beb3d25d 100644 --- a/src/middleware/publish-concept.js +++ b/src/middleware/publish-concept.js @@ -1,8 +1,12 @@ module.exports = function( req, res, next ) { - if(!req.body.publishAsConcept) { - req.body['publishDate'] = new Date(); - } else { - req.body['publishDate'] = null; - } - return next(); + const publishAsConcept = req.body.publishAsConcept; + + if(publishAsConcept === undefined || publishAsConcept === null) { + return next(); + } else if (!publishAsConcept) { + req.body['publishDate'] = new Date(); + } else { + req.body['publishDate'] = null; + } + return next(); } \ No newline at end of file