aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-29 12:13:19 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-29 12:13:19 +0100
commit4d32448895ad29ef694bcf790d59253249ad5939 (patch)
treec81643455db459dd90f004a7d2669e22a092fa4f /server/helpers
parent98ac898a03ed7bbb4edec74fe823b3f2d6d4904a (diff)
downloadPeerTube-4d32448895ad29ef694bcf790d59253249ad5939.tar.gz
PeerTube-4d32448895ad29ef694bcf790d59253249ad5939.tar.zst
PeerTube-4d32448895ad29ef694bcf790d59253249ad5939.zip
Server: use binary data instead of base64 to send thumbnails
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/videos.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index da857ba5f..4aaa6aaa9 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -17,7 +17,7 @@ const videosValidators = {
17 isVideoNameValid, 17 isVideoNameValid,
18 isVideoTagsValid, 18 isVideoTagsValid,
19 isVideoThumbnailValid, 19 isVideoThumbnailValid,
20 isVideoThumbnail64Valid 20 isVideoThumbnailDataValid
21} 21}
22 22
23function isEachRemoteVideosValid (requests) { 23function isEachRemoteVideosValid (requests) {
@@ -33,7 +33,7 @@ function isEachRemoteVideosValid (requests) {
33 isVideoInfoHashValid(video.infoHash) && 33 isVideoInfoHashValid(video.infoHash) &&
34 isVideoNameValid(video.name) && 34 isVideoNameValid(video.name) &&
35 isVideoTagsValid(video.tags) && 35 isVideoTagsValid(video.tags) &&
36 isVideoThumbnail64Valid(video.thumbnailBase64) && 36 isVideoThumbnailDataValid(video.thumbnailData) &&
37 isVideoRemoteIdValid(video.remoteId) && 37 isVideoRemoteIdValid(video.remoteId) &&
38 isVideoExtnameValid(video.extname) 38 isVideoExtnameValid(video.extname)
39 ) || 39 ) ||
@@ -86,9 +86,8 @@ function isVideoThumbnailValid (value) {
86 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL) 86 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL)
87} 87}
88 88
89function isVideoThumbnail64Valid (value) { 89function isVideoThumbnailDataValid (value) {
90 return validator.isBase64(value) && 90 return validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL_DATA)
91 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL64)
92} 91}
93 92
94function isVideoRemoteIdValid (value) { 93function isVideoRemoteIdValid (value) {