From 7bf8467637aa853f14ada8598b165c83d350cdaa Mon Sep 17 00:00:00 2001 From: j433866 Date: Mon, 1 Apr 2019 08:53:52 +0100 Subject: [PATCH] Add maximum limit to the thumbnail image size --- src/web/InputWaiter.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/web/InputWaiter.mjs b/src/web/InputWaiter.mjs index c61a5a26..87138984 100644 --- a/src/web/InputWaiter.mjs +++ b/src/web/InputWaiter.mjs @@ -699,12 +699,13 @@ class InputWaiter { */ displayFilePreview() { const inputNum = this.getActiveTab(), + input = this.getInput(inputNum), inputText = document.getElementById("input-text"), - fileSlice = this.getInput(inputNum).slice(0, 4096), + fileSlice = input.slice(0, 4096), fileThumb = document.getElementById("input-file-thumbnail"), - arrBuffer = new Uint8Array(this.getInput(inputNum)), + arrBuffer = new Uint8Array(input), type = isImage(arrBuffer); - if (type && type !== "image/tiff" && this.app.options.imagePreview) { + if (type && type !== "image/tiff" && this.app.options.imagePreview && input.byteLength < 1024000) { // Don't show TIFFs as not much supports them fileThumb.src = `data:${type};base64,${toBase64(arrBuffer)}`; } else {