mirror of https://github.com/Chocobozzz/PeerTube
Remove tmp file on image processing error
parent
9c85ee2ed0
commit
4ee7a4c9ac
|
@ -50,7 +50,14 @@ async function downloadImage (url: string, destDir: string, destName: string, si
|
||||||
await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath)
|
await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath)
|
||||||
|
|
||||||
const destPath = join(destDir, destName)
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -270,7 +270,7 @@ async function refreshActorIfNeeded (
|
||||||
return { refreshed: true, actor }
|
return { refreshed: true, actor }
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.warn('Cannot refresh actor.', { err })
|
logger.warn('Cannot refresh actor %s.', actor.url, { err })
|
||||||
return { actor, refreshed: false }
|
return { actor, refreshed: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue