mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Upgrade express validator to v4
This commit is contained in:
parent
315cc0cc18
commit
b60e5f38da
19 changed files with 517 additions and 497 deletions
|
@ -107,12 +107,13 @@ function isVideoRatingTypeValid (value: string) {
|
|||
return values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1
|
||||
}
|
||||
|
||||
function isVideoFile (value: string, files: { [ fieldname: string ]: Express.Multer.File[] }) {
|
||||
function isVideoFile (files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[]) {
|
||||
// Should have files
|
||||
if (!files) return false
|
||||
if (isArray(files)) return false
|
||||
|
||||
// Should have videofile file
|
||||
const videofile = files.videofile
|
||||
const videofile = files['videofile']
|
||||
if (!videofile || videofile.length === 0) return false
|
||||
|
||||
// The file should exist
|
||||
|
@ -168,34 +169,3 @@ export {
|
|||
isVideoFileSizeValid,
|
||||
isVideoFileResolutionValid
|
||||
}
|
||||
|
||||
declare module 'express-validator' {
|
||||
export interface Validator {
|
||||
isVideoIdOrUUIDValid,
|
||||
isVideoAuthorValid,
|
||||
isVideoDateValid,
|
||||
isVideoCategoryValid,
|
||||
isVideoLicenceValid,
|
||||
isVideoLanguageValid,
|
||||
isVideoNSFWValid,
|
||||
isVideoDescriptionValid,
|
||||
isVideoDurationValid,
|
||||
isVideoInfoHashValid,
|
||||
isVideoNameValid,
|
||||
isVideoTagsValid,
|
||||
isVideoThumbnailValid,
|
||||
isVideoThumbnailDataValid,
|
||||
isVideoExtnameValid,
|
||||
isVideoUUIDValid,
|
||||
isVideoAbuseReasonValid,
|
||||
isVideoAbuseReporterUsernameValid,
|
||||
isVideoFile,
|
||||
isVideoViewsValid,
|
||||
isVideoLikesValid,
|
||||
isVideoRatingTypeValid,
|
||||
isVideoDislikesValid,
|
||||
isVideoEventCountValid,
|
||||
isVideoFileSizeValid,
|
||||
isVideoFileResolutionValid
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue