]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/requests.ts
Merge branch 'master' into develop
[github/Chocobozzz/PeerTube.git] / server / helpers / requests.ts
index 60c94da81160d327df6fc9f3e02c829eef9b11fa..2e30c94a1e8ed2e53846bebb0e92c2fad9fc976f 100644 (file)
@@ -50,7 +50,14 @@ async function downloadImage (url: string, destDir: string, destName: string, si
   await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath)
 
   const destPath = join(destDir, destName)
-  await processImage({ path: tmpPath }, destPath, size)
+
+  try {
+    await processImage(tmpPath, destPath, size)
+  } catch (err) {
+    await remove(tmpPath)
+
+    throw err
+  }
 }
 
 // ---------------------------------------------------------------------------