]>
Commit | Line | Data |
---|---|---|
213e30ef C |
1 | |
2 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | |
3 | import { isFileValid } from './misc' | |
4 | ||
5 | const imageMimeTypes = CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME | |
6 | .map(v => v.replace('.', '')) | |
7 | .join('|') | |
8 | const imageMimeTypesRegex = `image/(${imageMimeTypes})` | |
9 | function isActorImageFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[], fieldname: string) { | |
10 | return isFileValid(files, imageMimeTypesRegex, fieldname, CONSTRAINTS_FIELDS.ACTORS.IMAGE.FILE_SIZE.max) | |
11 | } | |
12 | ||
13 | // --------------------------------------------------------------------------- | |
14 | ||
15 | export { | |
16 | isActorImageFile | |
17 | } |