]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/video-imports.ts
Add search target check params
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / video-imports.ts
index c571f5dddccfb701dddd78ae899a8bc4e0873033..33a1fa8ab9ccdd9fffa1d59961a33bf85b395080 100644 (file)
@@ -23,8 +23,10 @@ function isVideoImportStateValid (value: any) {
   return exists(value) && VIDEO_IMPORT_STATES[value] !== undefined
 }
 
-const videoTorrentImportTypes = Object.keys(MIMETYPES.TORRENT.MIMETYPE_EXT).map(m => `(${m})`)
-const videoTorrentImportRegex = videoTorrentImportTypes.join('|')
+const videoTorrentImportRegex = Object.keys(MIMETYPES.TORRENT.MIMETYPE_EXT)
+                                      .concat([ 'application/octet-stream' ]) // MacOS sends application/octet-stream
+                                      .map(m => `(${m})`)
+                                      .join('|')
 function isVideoImportTorrentFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) {
   return isFileValid(files, videoTorrentImportRegex, 'torrentfile', CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_FILE.FILE_SIZE.max, true)
 }