From c5fa9fe70ef04d70311ffc609381b1a3614ea2c9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Jul 2024 08:07:30 +0200 Subject: [PATCH] More robust updateTorrentMetadata fn --- server/core/helpers/webtorrent.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/core/helpers/webtorrent.ts b/server/core/helpers/webtorrent.ts index f7e4627db..318632fb3 100644 --- a/server/core/helpers/webtorrent.ts +++ b/server/core/helpers/webtorrent.ts @@ -142,6 +142,11 @@ async function createTorrentAndSetInfoHashFromPath ( async function updateTorrentMetadata (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) { const video = extractVideo(videoOrPlaylist) + if (!videoFile.torrentFilename) { + logger.error(`Video file ${videoFile.filename} of video ${video.uuid} doesn't have a torrent file, skipping torrent metadata update`) + return + } + const oldTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename) if (!await pathExists(oldTorrentPath)) {