aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/misc.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-25 16:19:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitfb7194043d0486ce0a6a40b2ffbdf32878c33a6f (patch)
tree6ed304a5d730a75da0a4460b3009df88684fa598 /server/helpers/custom-validators/misc.ts
parenta5cf76afa378aae81af2a9b0ce548e5d2582f832 (diff)
downloadPeerTube-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.ts5
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
48function isIntOrNull (value: any) {
49 return value === null || validator.isInt('' + value)
50}
51
48function toIntOrNull (value: string) { 52function 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,