Send/reply: Be resilient to errors making attachment thumbnail (#2468)
* Show generic file icon if we fail to make attachment thumbnail * Be resilient to thumbnail creation errors when creating quote
This commit is contained in:
parent
8eeaad8e18
commit
a4603807e1
2 changed files with 30 additions and 10 deletions
|
@ -735,13 +735,25 @@
|
|||
const willMakeThumbnail =
|
||||
Signal.Util.GoogleChrome.isImageTypeSupported(contentType) ||
|
||||
Signal.Util.GoogleChrome.isVideoTypeSupported(contentType);
|
||||
const makeThumbnail = async () => {
|
||||
try {
|
||||
if (willMakeThumbnail) {
|
||||
return await this.makeThumbnailAttachment(attachment);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(
|
||||
'Failed to create quote thumbnail',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
return {
|
||||
contentType,
|
||||
fileName: attachment.fileName,
|
||||
thumbnail: willMakeThumbnail
|
||||
? await this.makeThumbnailAttachment(attachment)
|
||||
: null,
|
||||
thumbnail: makeThumbnail(),
|
||||
};
|
||||
})
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue