X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fmisc.ts;h=3dc5504e32545d611c3b9a1d325621cd6613c87a;hb=b8598d40f650a31fe09a4a5426dcdc2c5c0d566c;hp=c80c861932716e395574c3d76736bbd6915c85fd;hpb=28dca0a2211524bbf3ad17666c607eb6325763b8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts index c80c86193..3dc5504e3 100644 --- a/server/helpers/custom-validators/misc.ts +++ b/server/helpers/custom-validators/misc.ts @@ -86,7 +86,7 @@ function isFileValid (options: { // The file exists const file = fileArray[0] - if (!file || !file.originalname) return false + if (!file?.originalname) return false // Check size if ((maxSize !== null) && file.size > maxSize) return false @@ -136,12 +136,6 @@ function toValueOrNull (value: string) { return value } -function toArray (value: any) { - if (value && isArray(value) === false) return [ value ] - - return value -} - function toIntArray (value: any) { if (!value) return [] if (isArray(value) === false) return [ validator.toInt(value) ] @@ -170,7 +164,6 @@ export { isBooleanValid, toIntOrNull, areUUIDsValid, - toArray, toIntArray, isFileValid, checkMimetypeRegex