From 46e5305f2332799db329123be1486fdc2c2d8d03 Mon Sep 17 00:00:00 2001 From: viljasenville <54019006+viljasenville@users.noreply.github.com> Date: Wed, 27 Jul 2022 11:17:20 +0300 Subject: [PATCH] Comic reader: ignore special files originating from Apple devices --- cps/static/js/kthoom.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cps/static/js/kthoom.js b/cps/static/js/kthoom.js index 268fe9ec..51dbadba 100644 --- a/cps/static/js/kthoom.js +++ b/cps/static/js/kthoom.js @@ -163,6 +163,14 @@ kthoom.ImageFile = function(file) { this.mimeType = undefined; break; } + + // Reset mime type for special files originating from Apple devices + // This folder may contain files having image extensions (for example .jpg) but those files are not actual images + // Trying to view these files cause corrupted/empty pages in the comic reader and files should be ignored + if (this.filename.indexOf("__MACOSX") !== -1) { + this.mimeType = undefined; + } + if ( this.mimeType !== undefined) { this.dataURI = createURLFromArray(file.fileData, this.mimeType); }