diff options
-rw-r--r-- | server/helpers/webtorrent.ts | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 012918468..becad533e 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts | |||
@@ -127,14 +127,10 @@ async function updateTorrentUrls (videoOrPlaylist: MVideo | MStreamingPlaylistVi | |||
127 | const newTorrentFilename = generateTorrentFileName(videoOrPlaylist, videoFile.resolution) | 127 | const newTorrentFilename = generateTorrentFileName(videoOrPlaylist, videoFile.resolution) |
128 | const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, newTorrentFilename) | 128 | const newTorrentPath = join(CONFIG.STORAGE.TORRENTS_DIR, newTorrentFilename) |
129 | 129 | ||
130 | logger.info('Updating torrent URLs %s.', newTorrentPath) | 130 | logger.info('Updating torrent URLs %s -> %s.', oldTorrentPath, newTorrentPath) |
131 | 131 | ||
132 | await writeFile(newTorrentPath, bencode.encode(decoded)) | 132 | await writeFile(newTorrentPath, bencode.encode(decoded)) |
133 | 133 | await remove(join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename)) | |
134 | // Remove old torrent file if it existed | ||
135 | if (videoFile.hasTorrent()) { | ||
136 | await remove(join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename)) | ||
137 | } | ||
138 | 134 | ||
139 | videoFile.torrentFilename = newTorrentFilename | 135 | videoFile.torrentFilename = newTorrentFilename |
140 | } | 136 | } |