diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-10 14:25:29 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-11 07:57:20 +0200 |
commit | 30bc55c88b3b7416c2224925e88639694fd32746 (patch) | |
tree | aebe3b1b8657198e432080f7d15a5694f19a8389 /server/helpers/custom-validators | |
parent | 560605026bfadab711cf6d34e9c7ea865887816a (diff) | |
download | PeerTube-30bc55c88b3b7416c2224925e88639694fd32746.tar.gz PeerTube-30bc55c88b3b7416c2224925e88639694fd32746.tar.zst PeerTube-30bc55c88b3b7416c2224925e88639694fd32746.zip |
Refactor video extensions logic in server
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 6 |
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 | ||
83 | function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) { | 83 | function 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 | ||
91 | const videoImageTypes = CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME | 87 | const videoImageTypes = CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME |