diff options
author | Chocobozzz <me@florianbigard.com> | 2020-09-25 16:19:35 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | fb7194043d0486ce0a6a40b2ffbdf32878c33a6f (patch) | |
tree | 6ed304a5d730a75da0a4460b3009df88684fa598 /server/helpers/custom-validators/misc.ts | |
parent | a5cf76afa378aae81af2a9b0ce548e5d2582f832 (diff) | |
download | PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.tar.gz PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.tar.zst PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.zip |
Check live duration and size
Diffstat (limited to 'server/helpers/custom-validators/misc.ts')
-rw-r--r-- | server/helpers/custom-validators/misc.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts index cf32201c4..61c03f0c9 100644 --- a/server/helpers/custom-validators/misc.ts +++ b/server/helpers/custom-validators/misc.ts | |||
@@ -45,6 +45,10 @@ function isBooleanValid (value: any) { | |||
45 | return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) | 45 | return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) |
46 | } | 46 | } |
47 | 47 | ||
48 | function isIntOrNull (value: any) { | ||
49 | return value === null || validator.isInt('' + value) | ||
50 | } | ||
51 | |||
48 | function toIntOrNull (value: string) { | 52 | function toIntOrNull (value: string) { |
49 | const v = toValueOrNull(value) | 53 | const v = toValueOrNull(value) |
50 | 54 | ||
@@ -116,6 +120,7 @@ export { | |||
116 | isArrayOf, | 120 | isArrayOf, |
117 | isNotEmptyIntArray, | 121 | isNotEmptyIntArray, |
118 | isArray, | 122 | isArray, |
123 | isIntOrNull, | ||
119 | isIdValid, | 124 | isIdValid, |
120 | isSafePath, | 125 | isSafePath, |
121 | isUUIDValid, | 126 | isUUIDValid, |