]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix upload without files
authorChocobozzz <me@florianbigard.com>
Thu, 5 Aug 2021 12:24:03 +0000 (14:24 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 5 Aug 2021 12:24:03 +0000 (14:24 +0200)
server/middlewares/validators/videos/videos.ts

index 374a59c50d850c13a83147b1d5b4f81f5045760a..13187f3985a854347f61f45374719f344efafa43 100644 (file)
@@ -188,7 +188,7 @@ const videosAddResumableInitValidator = getCommonVideoEditAttributes().concat([
     // multer required unsetting the Content-Type, now we can set it for node-uploadx
     req.headers['content-type'] = 'application/json; charset=utf-8'
     // place previewfile in metadata so that uploadx saves it in .META
-    if (req.files['previewfile']) req.body.previewfile = req.files['previewfile']
+    if (req.files?.['previewfile']) req.body.previewfile = req.files['previewfile']
 
     return next()
   }