diff --git a/js/models/conversations.js b/js/models/conversations.js index 0fe7403a7..b10635e8f 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -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(), }; }) ), diff --git a/js/views/file_input_view.js b/js/views/file_input_view.js index 3f4b9298a..bfdb2fb5e 100644 --- a/js/views/file_input_view.js +++ b/js/views/file_input_view.js @@ -274,13 +274,21 @@ this.addThumb(dataUrl); }; - if (Signal.Util.GoogleChrome.isImageTypeSupported(contentType)) { - renderImagePreview(); - } else if (Signal.Util.GoogleChrome.isVideoTypeSupported(contentType)) { - renderVideoPreview(); - } else if (MIME.isAudio(contentType)) { - this.addThumb('images/audio.svg'); - } else { + try { + if (Signal.Util.GoogleChrome.isImageTypeSupported(contentType)) { + await renderImagePreview(); + } else if (Signal.Util.GoogleChrome.isVideoTypeSupported(contentType)) { + await renderVideoPreview(); + } else if (MIME.isAudio(contentType)) { + this.addThumb('images/audio.svg'); + } else { + this.addThumb('images/file.svg'); + } + } catch (e) { + console.log( + `Was unable to generate thumbnail for file type ${contentType}`, + e && e.stack ? e.stack : e + ); this.addThumb('images/file.svg'); }