From eb11373f9373bdeca5a1e7868f868d9ec3b2c7b6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Mar 2020 09:46:50 +0100 Subject: Fix 500 when adding video in playlist --- server/controllers/api/video-playlist.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/controllers') diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index b51490bf9..aa9053372 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts @@ -463,7 +463,13 @@ async function regeneratePlaylistThumbnail (videoPlaylist: MVideoPlaylistThumbna async function generateThumbnailForPlaylist (videoPlaylist: MVideoPlaylistThumbnail, video: MVideoThumbnail) { logger.info('Generating default thumbnail to playlist %s.', videoPlaylist.url) - const inputPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, video.getMiniature().filename) + const videoMiniature = video.getMiniature() + if (!videoMiniature) { + logger.info('Cannot generate thumbnail for playlist %s because video %s does not have any.', videoPlaylist.url, video.url) + return + } + + const inputPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, videoMiniature.filename) const thumbnailModel = await createPlaylistMiniatureFromExisting(inputPath, videoPlaylist, true, true) thumbnailModel.videoPlaylistId = videoPlaylist.id -- cgit v1.2.3