diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 12:13:19 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 12:13:19 +0100 |
commit | 4d32448895ad29ef694bcf790d59253249ad5939 (patch) | |
tree | c81643455db459dd90f004a7d2669e22a092fa4f /server/helpers/custom-validators/videos.js | |
parent | 98ac898a03ed7bbb4edec74fe823b3f2d6d4904a (diff) | |
download | PeerTube-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/custom-validators/videos.js')
-rw-r--r-- | server/helpers/custom-validators/videos.js | 9 |
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 | ||
23 | function isEachRemoteVideosValid (requests) { | 23 | function 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 | ||
89 | function isVideoThumbnail64Valid (value) { | 89 | function 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 | ||
94 | function isVideoRemoteIdValid (value) { | 93 | function isVideoRemoteIdValid (value) { |