aboutsummaryrefslogtreecommitdiff
path: root/src/server/DashUploadUtils.ts
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2021-09-20 22:25:19 -0400
committermehekj <mehek.jethani@gmail.com>2021-09-20 22:25:19 -0400
commita8d8c9a115d1de3946a4f3d971c953f4b1222551 (patch)
tree86f56b6406216e694b9baa93af28f5ed5763c311 /src/server/DashUploadUtils.ts
parent64e265d9cba009469081fdf4ba3272c78a3a76a8 (diff)
parente295f6694bed9a3a35a0858c8f17745ef1506f51 (diff)
Merge branch 'master' into temporalmedia-mehek
Diffstat (limited to 'src/server/DashUploadUtils.ts')
-rw-r--r--src/server/DashUploadUtils.ts29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts
index 549dc0396..7b83d09ef 100644
--- a/src/server/DashUploadUtils.ts
+++ b/src/server/DashUploadUtils.ts
@@ -242,18 +242,23 @@ export namespace DashUploadUtils {
const { headers } = (await new Promise<any>((resolve, reject) => {
request.head(resolvedUrl, (error, res) => error ? reject(error) : resolve(res));
}).catch(error => console.error(error)));
- // Compute the native width and height ofthe image with an npm module
- const { width: nativeWidth, height: nativeHeight }: RequestedImageSize = await requestImageSize(resolvedUrl);
- // Bundle up the information into an object
- return {
- source,
- contentSize: parseInt(headers[size]),
- contentType: headers[type],
- nativeWidth,
- nativeHeight,
- filename,
- ...results
- };
+ try {
+ // Compute the native width and height ofthe image with an npm module
+ const { width: nativeWidth, height: nativeHeight } = await requestImageSize(resolvedUrl);
+ // Bundle up the information into an object
+ return {
+ source,
+ contentSize: parseInt(headers[size]),
+ contentType: headers[type],
+ nativeWidth,
+ nativeHeight,
+ filename,
+ ...results
+ };
+ } catch (e) {
+ console.log(e);
+ return e;
+ }
};
/**