mirror of
https://github.com/gchq/CyberChef
synced 2025-01-09 11:08:47 +00:00
Add maximum limit to the thumbnail image size
This commit is contained in:
parent
eb5809fd17
commit
7bf8467637
1 changed files with 4 additions and 3 deletions
|
@ -699,12 +699,13 @@ class InputWaiter {
|
||||||
*/
|
*/
|
||||||
displayFilePreview() {
|
displayFilePreview() {
|
||||||
const inputNum = this.getActiveTab(),
|
const inputNum = this.getActiveTab(),
|
||||||
|
input = this.getInput(inputNum),
|
||||||
inputText = document.getElementById("input-text"),
|
inputText = document.getElementById("input-text"),
|
||||||
fileSlice = this.getInput(inputNum).slice(0, 4096),
|
fileSlice = input.slice(0, 4096),
|
||||||
fileThumb = document.getElementById("input-file-thumbnail"),
|
fileThumb = document.getElementById("input-file-thumbnail"),
|
||||||
arrBuffer = new Uint8Array(this.getInput(inputNum)),
|
arrBuffer = new Uint8Array(input),
|
||||||
type = isImage(arrBuffer);
|
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
|
// Don't show TIFFs as not much supports them
|
||||||
fileThumb.src = `data:${type};base64,${toBase64(arrBuffer)}`;
|
fileThumb.src = `data:${type};base64,${toBase64(arrBuffer)}`;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue