diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-15 15:04:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:25:51 +0200 |
commit | 4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14 (patch) | |
tree | 4f6e24ec4c2464a10908296838ed137287c94ab4 /server | |
parent | 9c85ee2ed079206d95130e86eceffaf74893c5e3 (diff) | |
download | PeerTube-4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14.tar.gz PeerTube-4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14.tar.zst PeerTube-4ee7a4c9ac9280cda930a281c2d5a9a4c409cc14.zip |
Remove tmp file on image processing error
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/requests.ts | 9 | ||||
-rw-r--r-- | server/lib/activitypub/actor.ts | 2 |
2 files changed, 9 insertions, 2 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 | // --------------------------------------------------------------------------- |
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 0db75906c..25cd40905 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -270,7 +270,7 @@ async function refreshActorIfNeeded ( | |||
270 | return { refreshed: true, actor } | 270 | return { refreshed: true, actor } |
271 | }) | 271 | }) |
272 | } catch (err) { | 272 | } catch (err) { |
273 | logger.warn('Cannot refresh actor.', { err }) | 273 | logger.warn('Cannot refresh actor %s.', actor.url, { err }) |
274 | return { actor, refreshed: false } | 274 | return { actor, refreshed: false } |
275 | } | 275 | } |
276 | } | 276 | } |