aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-14 09:14:56 -0400
committerbobzel <zzzman@gmail.com>2021-09-14 09:14:56 -0400
commitfc68dcd02c36c41813a5aecb37602fd9a7cdaebe (patch)
treec576d077007b61804d55e6483f0cdc5fe71d81c9 /src
parent4bdd8c4304d0512b69cada37bbed76f3a093e889 (diff)
fixed crash for loading some images (e.g, .tiff)
Diffstat (limited to 'src')
-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;
+ }
};
/**