mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-12-01 04:49:16 -06:00
25 lines
665 B
TypeScript
25 lines
665 B
TypeScript
|
|
import { UploadFilesForCheck } from 'express'
|
|
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
|
|
import { isFileValid } from './misc'
|
|
|
|
const imageMimeTypes = CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME
|
|
.map(v => v.replace('.', ''))
|
|
.join('|')
|
|
const imageMimeTypesRegex = `image/(${imageMimeTypes})`
|
|
|
|
function isActorImageFile (files: UploadFilesForCheck, fieldname: string) {
|
|
return isFileValid({
|
|
files,
|
|
mimeTypeRegex: imageMimeTypesRegex,
|
|
field: fieldname,
|
|
maxSize: CONSTRAINTS_FIELDS.ACTORS.IMAGE.FILE_SIZE.max
|
|
})
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export {
|
|
isActorImageFile
|
|
}
|