X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fwebtorrent.ts;h=ecf63e93e7434c421d4273cf6c34322c8bc30c1f;hb=171efc48e67498406feb6d7873b3482b41505515;hp=d8220ba9c6583e3acb13e8ec7de8ba306a8fd983;hpb=8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index d8220ba9c..ecf63e93e 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts @@ -103,6 +103,11 @@ async function createTorrentAndSetInfoHash ( await writeFile(torrentPath, torrent) + // Remove old torrent file if it existed + if (videoFile.hasTorrent()) { + await remove(join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename)) + } + const parsedTorrent = parseTorrent(torrent) videoFile.infoHash = parsedTorrent.infoHash videoFile.torrentFilename = torrentFilename