aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-10 14:25:29 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-11 07:57:20 +0200
commit30bc55c88b3b7416c2224925e88639694fd32746 (patch)
treeaebe3b1b8657198e432080f7d15a5694f19a8389 /server/helpers/custom-validators/videos.ts
parent560605026bfadab711cf6d34e9c7ea865887816a (diff)
downloadPeerTube-30bc55c88b3b7416c2224925e88639694fd32746.tar.gz
PeerTube-30bc55c88b3b7416c2224925e88639694fd32746.tar.zst
PeerTube-30bc55c88b3b7416c2224925e88639694fd32746.zip
Refactor video extensions logic in server
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r--server/helpers/custom-validators/videos.ts6
1 files changed, 1 insertions, 5 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index 60e8075f6..40fecc09b 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -81,11 +81,7 @@ function isVideoFileExtnameValid (value: string) {
81} 81}
82 82
83function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) { 83function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) {
84 const videoFileTypesRegex = Object.keys(MIMETYPES.VIDEO.MIMETYPE_EXT) 84 return isFileValid(files, MIMETYPES.VIDEO.MIMETYPES_REGEX, 'videofile', null)
85 .map(m => `(${m})`)
86 .join('|')
87
88 return isFileValid(files, videoFileTypesRegex, 'videofile', null)
89} 85}
90 86
91const videoImageTypes = CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME 87const videoImageTypes = CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME