diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-01 10:44:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-01 10:44:16 +0200 |
commit | e95e0463d8ef0d0a690e716df93c3c78b74737af (patch) | |
tree | dfb0fa50d6caa89d6f84f5ab41d93fa632409f44 /server/lib/job-queue | |
parent | 26649b4215ac68eed5601d9412d2d7ddee98b543 (diff) | |
download | PeerTube-e95e0463d8ef0d0a690e716df93c3c78b74737af.tar.gz PeerTube-e95e0463d8ef0d0a690e716df93c3c78b74737af.tar.zst PeerTube-e95e0463d8ef0d0a690e716df93c3c78b74737af.zip |
Correctly delete files on failed import
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 4 |
1 files 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' | |||
14 | import { VideoModel } from '../../../models/video/video' | 14 | import { VideoModel } from '../../../models/video/video' |
15 | import { downloadWebTorrentVideo } from '../../../helpers/webtorrent' | 15 | import { downloadWebTorrentVideo } from '../../../helpers/webtorrent' |
16 | import { getSecureTorrentName } from '../../../helpers/utils' | 16 | import { getSecureTorrentName } from '../../../helpers/utils' |
17 | import { rename, stat } from 'fs-extra' | 17 | import { remove, rename, stat } from 'fs-extra' |
18 | 18 | ||
19 | type VideoImportYoutubeDLPayload = { | 19 | type VideoImportYoutubeDLPayload = { |
20 | type: 'youtube-dl' | 20 | type: 'youtube-dl' |
@@ -209,7 +209,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide | |||
209 | 209 | ||
210 | } catch (err) { | 210 | } catch (err) { |
211 | try { | 211 | try { |
212 | // if (tempVideoPath) await unlinkPromise(tempVideoPath) | 212 | if (tempVideoPath) await remove(tempVideoPath) |
213 | } catch (errUnlink) { | 213 | } catch (errUnlink) { |
214 | logger.warn('Cannot cleanup files after a video import error.', { err: errUnlink }) | 214 | logger.warn('Cannot cleanup files after a video import error.', { err: errUnlink }) |
215 | } | 215 | } |