From e95e0463d8ef0d0a690e716df93c3c78b74737af Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 1 Oct 2018 10:44:16 +0200 Subject: Correctly delete files on failed import --- server/lib/job-queue/handlers/video-import.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 9e14e57e6..8f237dd91 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts @@ -14,7 +14,7 @@ import { federateVideoIfNeeded } from '../../activitypub' import { VideoModel } from '../../../models/video/video' import { downloadWebTorrentVideo } from '../../../helpers/webtorrent' import { getSecureTorrentName } from '../../../helpers/utils' -import { rename, stat } from 'fs-extra' +import { remove, rename, stat } from 'fs-extra' type VideoImportYoutubeDLPayload = { type: 'youtube-dl' @@ -209,7 +209,7 @@ async function processFile (downloader: () => Promise, videoImport: Vide } catch (err) { try { - // if (tempVideoPath) await unlinkPromise(tempVideoPath) + if (tempVideoPath) await remove(tempVideoPath) } catch (errUnlink) { logger.warn('Cannot cleanup files after a video import error.', { err: errUnlink }) } -- cgit v1.2.3