diff options
author | Chocobozzz <me@florianbigard.com> | 2020-03-19 09:46:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-03-19 09:46:50 +0100 |
commit | eb11373f9373bdeca5a1e7868f868d9ec3b2c7b6 (patch) | |
tree | e3d0873d0b340483e3ef977e7fdd2e313008528b | |
parent | b06904bee108be3693646080288b5bc975edb4f2 (diff) | |
download | PeerTube-eb11373f9373bdeca5a1e7868f868d9ec3b2c7b6.tar.gz PeerTube-eb11373f9373bdeca5a1e7868f868d9ec3b2c7b6.tar.zst PeerTube-eb11373f9373bdeca5a1e7868f868d9ec3b2c7b6.zip |
Fix 500 when adding video in playlist
-rw-r--r-- | server/controllers/api/video-playlist.ts | 8 |
1 files changed, 7 insertions, 1 deletions
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 | |||
463 | async function generateThumbnailForPlaylist (videoPlaylist: MVideoPlaylistThumbnail, video: MVideoThumbnail) { | 463 | async function generateThumbnailForPlaylist (videoPlaylist: MVideoPlaylistThumbnail, video: MVideoThumbnail) { |
464 | logger.info('Generating default thumbnail to playlist %s.', videoPlaylist.url) | 464 | logger.info('Generating default thumbnail to playlist %s.', videoPlaylist.url) |
465 | 465 | ||
466 | const inputPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, video.getMiniature().filename) | 466 | const videoMiniature = video.getMiniature() |
467 | if (!videoMiniature) { | ||
468 | logger.info('Cannot generate thumbnail for playlist %s because video %s does not have any.', videoPlaylist.url, video.url) | ||
469 | return | ||
470 | } | ||
471 | |||
472 | const inputPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, videoMiniature.filename) | ||
467 | const thumbnailModel = await createPlaylistMiniatureFromExisting(inputPath, videoPlaylist, true, true) | 473 | const thumbnailModel = await createPlaylistMiniatureFromExisting(inputPath, videoPlaylist, true, true) |
468 | 474 | ||
469 | thumbnailModel.videoPlaylistId = videoPlaylist.id | 475 | thumbnailModel.videoPlaylistId = videoPlaylist.id |