aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-15 15:04:02 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:25:51 +0200
commit4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14 (patch)
tree4f6e24ec4c2464a10908296838ed137287c94ab4 /server/helpers
parent9c85ee2ed079206d95130e86eceffaf74893c5e3 (diff)
downloadPeerTube-4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14.tar.gz
PeerTube-4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14.tar.zst
PeerTube-4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14.zip
Remove tmp file on image processing error
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/requests.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts
index 60c94da81..8dda6c039 100644
--- a/server/helpers/requests.ts
+++ b/server/helpers/requests.ts
@@ -50,7 +50,14 @@ async function downloadImage (url: string, destDir: string, destName: string, si
50 await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath) 50 await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath)
51 51
52 const destPath = join(destDir, destName) 52 const destPath = join(destDir, destName)
53 await processImage({ path: tmpPath }, destPath, size) 53
54 try {
55 await processImage({ path: tmpPath }, destPath, size)
56 } catch (err) {
57 await remove(tmpPath)
58
59 throw err
60 }
54} 61}
55 62
56// --------------------------------------------------------------------------- 63// ---------------------------------------------------------------------------