From: Chocobozzz Date: Thu, 19 Oct 2017 07:28:35 +0000 (+0200) Subject: Fix video removing when it is corrupted X-Git-Tag: v0.0.1-alpha~285 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=9fd540562c356cb54b98861d2d9e7d4fbfcd00e0;p=github%2FChocobozzz%2FPeerTube.git Fix video removing when it is corrupted --- diff --git a/server/models/video/video.ts b/server/models/video/video.ts index fb18a485a..4bd8eb98f 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -334,12 +334,15 @@ function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.T // Remove physical files and torrents video.VideoFiles.forEach(file => { - video.removeFile(file), - video.removeTorrent(file) + tasks.push(video.removeFile(file)) + tasks.push(video.removeTorrent(file)) }) } return Promise.all(tasks) + .catch(err => { + logger.error('Some errors when removing files of video %d in after destroy hook.', video.uuid, err) + }) } getOriginalFile = function (this: VideoInstance) {