aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-18 08:48:24 +0200
committerChocobozzz <me@florianbigard.com>2018-10-18 10:44:15 +0200
commite27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98 (patch)
tree81b45623621952bd75efa3f701e5a8bd37a50f03 /server/helpers/custom-validators
parent244b4ae3973bc1511464a08158a123767f83179c (diff)
downloadPeerTube-e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98.tar.gz
PeerTube-e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98.tar.zst
PeerTube-e27ff5da6ed7bc1f56f50f862b80fb0c7d8a6d98.zip
AP mimeType -> mediaType
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/activitypub/videos.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts
index f88d26561..95fe824b9 100644
--- a/server/helpers/custom-validators/activitypub/videos.ts
+++ b/server/helpers/custom-validators/activitypub/videos.ts
@@ -81,19 +81,20 @@ function isRemoteVideoUrlValid (url: any) {
81 81
82 return url.type === 'Link' && 82 return url.type === 'Link' &&
83 ( 83 (
84 ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mimeType) !== -1 && 84 // TODO: remove mimeType (backward compatibility, introduced in v1.1.0)
85 ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mediaType || url.mimeType) !== -1 &&
85 isActivityPubUrlValid(url.href) && 86 isActivityPubUrlValid(url.href) &&
86 validator.isInt(url.height + '', { min: 0 }) && 87 validator.isInt(url.height + '', { min: 0 }) &&
87 validator.isInt(url.size + '', { min: 0 }) && 88 validator.isInt(url.size + '', { min: 0 }) &&
88 (!url.fps || validator.isInt(url.fps + '', { min: -1 })) 89 (!url.fps || validator.isInt(url.fps + '', { min: -1 }))
89 ) || 90 ) ||
90 ( 91 (
91 ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mimeType) !== -1 && 92 ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mediaType || url.mimeType) !== -1 &&
92 isActivityPubUrlValid(url.href) && 93 isActivityPubUrlValid(url.href) &&
93 validator.isInt(url.height + '', { min: 0 }) 94 validator.isInt(url.height + '', { min: 0 })
94 ) || 95 ) ||
95 ( 96 (
96 ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mimeType) !== -1 && 97 ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mediaType || url.mimeType) !== -1 &&
97 validator.isLength(url.href, { min: 5 }) && 98 validator.isLength(url.href, { min: 5 }) &&
98 validator.isInt(url.height + '', { min: 0 }) 99 validator.isInt(url.height + '', { min: 0 })
99 ) 100 )