Remove tmp file on image processing error

pull/1787/head
Chocobozzz 2019-04-15 15:04:02 +02:00
parent 9c85ee2ed0
commit 4ee7a4c9ac
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 9 additions and 2 deletions

View 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({ path: tmpPath }, destPath, size)
} catch (err) {
await remove(tmpPath)
throw err
}
}
// ---------------------------------------------------------------------------

View File

@ -270,7 +270,7 @@ async function refreshActorIfNeeded (
return { refreshed: true, actor }
})
} catch (err) {
logger.warn('Cannot refresh actor.', { err })
logger.warn('Cannot refresh actor %s.', actor.url, { err })
return { actor, refreshed: false }
}
}