X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Frequests.ts;h=2e30c94a1e8ed2e53846bebb0e92c2fad9fc976f;hb=a41b9da1a9ce49df82ea10c82de4c2fbc6d1b189;hp=60c94da81160d327df6fc9f3e02c829eef9b11fa;hpb=74dc3bca2b14f5fd3fe80c394dfc34177a46db77;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 60c94da81..2e30c94a1 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 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 + } } // ---------------------------------------------------------------------------