diff options
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1e5648a36..0f0f894e4 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -762,8 +762,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
762 | 762 | ||
763 | // Remove physical files and torrents | 763 | // Remove physical files and torrents |
764 | instance.VideoFiles.forEach(file => { | 764 | instance.VideoFiles.forEach(file => { |
765 | tasks.push(instance.removeFile(file)) | 765 | tasks.push(instance.removeFileAndTorrent(file)) |
766 | tasks.push(file.removeTorrent()) | ||
767 | }) | 766 | }) |
768 | 767 | ||
769 | // Remove playlists file | 768 | // Remove playlists file |
@@ -1670,10 +1669,13 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
1670 | .concat(toAdd) | 1669 | .concat(toAdd) |
1671 | } | 1670 | } |
1672 | 1671 | ||
1673 | removeFile (videoFile: MVideoFile, isRedundancy = false) { | 1672 | removeFileAndTorrent (videoFile: MVideoFile, isRedundancy = false) { |
1674 | const filePath = getVideoFilePath(this, videoFile, isRedundancy) | 1673 | const filePath = getVideoFilePath(this, videoFile, isRedundancy) |
1675 | return remove(filePath) | 1674 | |
1676 | .catch(err => logger.warn('Cannot delete file %s.', filePath, { err })) | 1675 | const promises: Promise<any>[] = [ remove(filePath) ] |
1676 | if (!isRedundancy) promises.push(videoFile.removeTorrent()) | ||
1677 | |||
1678 | return Promise.all(promises) | ||
1677 | } | 1679 | } |
1678 | 1680 | ||
1679 | async removeStreamingPlaylistFiles (streamingPlaylist: MStreamingPlaylist, isRedundancy = false) { | 1681 | async removeStreamingPlaylistFiles (streamingPlaylist: MStreamingPlaylist, isRedundancy = false) { |