diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-04 15:12:54 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-04 16:04:14 +0100 |
commit | 745778256ced65415b04a9817fc49db70d4b6681 (patch) | |
tree | 184a3cd6c7d24ba94c5aa282b52a162a3b95d21c /server/helpers/requests.ts | |
parent | 2beb98952a4c5939f33ea2dc77f0bd053bffbb5a (diff) | |
download | PeerTube-745778256ced65415b04a9817fc49db70d4b6681.tar.gz PeerTube-745778256ced65415b04a9817fc49db70d4b6681.tar.zst PeerTube-745778256ced65415b04a9817fc49db70d4b6681.zip |
Fix thumbnail processing
Diffstat (limited to 'server/helpers/requests.ts')
-rw-r--r-- | server/helpers/requests.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 805930a9f..5760ad1c1 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -3,6 +3,7 @@ import { createWriteStream } from 'fs-extra' | |||
3 | import * as request from 'request' | 3 | import * as request from 'request' |
4 | import { ACTIVITY_PUB } from '../initializers' | 4 | import { ACTIVITY_PUB } from '../initializers' |
5 | import { processImage } from './image-utils' | 5 | import { processImage } from './image-utils' |
6 | import { extname } from 'path' | ||
6 | 7 | ||
7 | function doRequest <T> ( | 8 | function doRequest <T> ( |
8 | requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean } | 9 | requestOptions: request.CoreOptions & request.UriOptions & { activityPub?: boolean } |
@@ -29,8 +30,7 @@ function doRequestAndSaveToFile (requestOptions: request.CoreOptions & request.U | |||
29 | } | 30 | } |
30 | 31 | ||
31 | async function downloadImage (url: string, destPath: string, size: { width: number, height: number }) { | 32 | async function downloadImage (url: string, destPath: string, size: { width: number, height: number }) { |
32 | const tmpPath = destPath + '.tmp' | 33 | const tmpPath = destPath + '.tmp' + extname(destPath) |
33 | |||
34 | await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath) | 34 | await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath) |
35 | 35 | ||
36 | await processImage({ path: tmpPath }, destPath, size) | 36 | await processImage({ path: tmpPath }, destPath, size) |