]> 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 ffad482b47fb5236e3627b7881971b1382c018ae..33a1fa8ab9ccdd9fffa1d59961a33bf85b395080 100644 (file)
@@ -20,11 +20,13 @@ function isVideoImportTargetUrlValid (url: string) {
 }
 
 function isVideoImportStateValid (value: any) {
-  return exists(value) && VIDEO_IMPORT_STATES[ value ] !== undefined
+  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)
 }