aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-16 09:28:18 +0200
committerChocobozzz <me@florianbigard.com>2018-05-16 09:42:56 +0200
commit2efd32f697549c59337db5177a93749af8e605d8 (patch)
tree42adaa4bb67b6aa48dcd4fb660616fb37b611573 /server/helpers/custom-validators
parent17c49e60b367868c80f44b9921793dc3a2d9adaa (diff)
downloadPeerTube-2efd32f697549c59337db5177a93749af8e605d8.tar.gz
PeerTube-2efd32f697549c59337db5177a93749af8e605d8.tar.zst
PeerTube-2efd32f697549c59337db5177a93749af8e605d8.zip
Fix updating video tags to empty field
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/misc.ts4
-rw-r--r--server/helpers/custom-validators/videos.ts8
2 files changed, 7 insertions, 5 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index 275482fa1..254b4db6c 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -35,7 +35,7 @@ function toIntOrNull (value: string) {
35 return validator.toInt(value) 35 return validator.toInt(value)
36} 36}
37 37
38function toStringOrNull (value: string) { 38function toValueOrNull (value: string) {
39 if (value === 'null') return null 39 if (value === 'null') return null
40 40
41 return value 41 return value
@@ -73,7 +73,7 @@ export {
73 isUUIDValid, 73 isUUIDValid,
74 isIdOrUUIDValid, 74 isIdOrUUIDValid,
75 isDateValid, 75 isDateValid,
76 toStringOrNull, 76 toValueOrNull,
77 isBooleanValid, 77 isBooleanValid,
78 toIntOrNull, 78 toIntOrNull,
79 isFileValid 79 isFileValid
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index c35db49ac..002324fe0 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -57,9 +57,11 @@ function isVideoTagValid (tag: string) {
57} 57}
58 58
59function isVideoTagsValid (tags: string[]) { 59function isVideoTagsValid (tags: string[]) {
60 return isArray(tags) && 60 return tags === null || (
61 validator.isInt(tags.length.toString(), VIDEOS_CONSTRAINTS_FIELDS.TAGS) && 61 isArray(tags) &&
62 tags.every(tag => isVideoTagValid(tag)) 62 validator.isInt(tags.length.toString(), VIDEOS_CONSTRAINTS_FIELDS.TAGS) &&
63 tags.every(tag => isVideoTagValid(tag))
64 )
63} 65}
64 66
65function isVideoAbuseReasonValid (value: string) { 67function isVideoAbuseReasonValid (value: string) {