X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideos.ts;h=e99992236b5f2dca67c0872369d5a7ee3c6f1805;hb=de6310b2fcbb8a6b79c546b23dfa1920724faaa7;hp=60e8075f6466ca0388d9151ec0624b167c27d1ac;hpb=610d0be13b3d01f653ef269271dd667a57c85ef2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 60e8075f6..e99992236 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -8,7 +8,8 @@ import { VIDEO_LICENCES, VIDEO_PRIVACIES, VIDEO_RATE_TYPES, - VIDEO_STATES + VIDEO_STATES, + VIDEO_LIVE } from '../../initializers/constants' import { exists, isArray, isDateValid, isFileValid } from './misc' import * as magnetUtil from 'magnet-uri' @@ -77,15 +78,11 @@ function isVideoRatingTypeValid (value: string) { } function isVideoFileExtnameValid (value: string) { - return exists(value) && MIMETYPES.VIDEO.EXT_MIMETYPE[value] !== undefined + return exists(value) && (value === VIDEO_LIVE.EXTENSION || MIMETYPES.VIDEO.EXT_MIMETYPE[value] !== undefined) } function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) { - const videoFileTypesRegex = Object.keys(MIMETYPES.VIDEO.MIMETYPE_EXT) - .map(m => `(${m})`) - .join('|') - - return isFileValid(files, videoFileTypesRegex, 'videofile', null) + return isFileValid(files, MIMETYPES.VIDEO.MIMETYPES_REGEX, 'videofile', null) } const videoImageTypes = CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME