From c77fa067a18a1fea34d5f277da19c2e4712018fa Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Nov 2016 21:16:41 +0100 Subject: Server: fix thumbnail in remote videos --- server/controllers/api/remote.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/remote.js b/server/controllers/api/remote.js index 4085deb2d..3e2aa6375 100644 --- a/server/controllers/api/remote.js +++ b/server/controllers/api/remote.js @@ -55,11 +55,15 @@ function remoteVideos (req, res, next) { function addRemoteVideo (videoToCreateData, callback) { logger.debug('Adding remote video %s.', videoToCreateData.magnetUri) - // Mongoose pre hook will automatically create the thumbnail on disk - videoToCreateData.thumbnail = videoToCreateData.thumbnailBase64 - const video = new Video(videoToCreateData) - video.save(callback) + Video.generateThumbnailFromBase64(video, videoToCreateData.thumbnailBase64, function (err) { + if (err) { + logger.error('Cannot generate thumbnail from base 64 data.', { error: err }) + return callback(err) + } + + video.save(callback) + }) } function removeRemoteVideo (videoToRemoveData, fromHost, callback) { -- cgit v1.2.3