From d0939b86ab9c6a1dcd26bb7fd7293adb6291584c Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Mon, 29 Jun 2020 10:13:38 +0100 Subject: [PATCH] More readable diagnostics Former-commit-id: d76a01364aaa44b01c372b35f6b1024e05cac1d5 [formerly 8b3568396e7d91b21fdf5f93815fc8a4384b1e72] Former-commit-id: c3b421c0fb07cead8301b37327be95ccd17cc49c --- www/js/lib/zimfile.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/js/lib/zimfile.js b/www/js/lib/zimfile.js index 84d99a62..608e8990 100644 --- a/www/js/lib/zimfile.js +++ b/www/js/lib/zimfile.js @@ -265,10 +265,13 @@ define(['xzdec_wrapper', 'util', 'utf8', 'q', 'zimDirEntry'], function(xz, util, var mimeListPos = readInt(header, 56, 8); var urlPtrPos = readInt(header, 32, 8); var endReadPos = urlPtrPos >= 1104 ? 1104 : urlPtrPos; + // DIAGNOSTICS FOR Kiwix JS Windows #89 if (endReadPos !== urlPtrPos) { - console.warn("WARNING: archive " + fileArray[0].name + " has urlPtrPos at offset " + urlPtrPos + - ", and attempted to read an arrayBuffer of " + (urlPtrPos - mimeListPos) + " bytes while extracting the MIME type table.\n" + - "We limited the buffer size to " + (endReadPos - mimeListPos) + "."); + console.warn("WARNING: " + fileArray[0].name + " has urlPtrPos at offset " + urlPtrPos + ".\n" + + "Attempted to read an arrayBuffer of **" + Math.floor((urlPtrPos - mimeListPos) / 10485.76) / 100 + " MB** while extracting MIME type table!\n" + + "We limited the buffer size to " + (endReadPos - mimeListPos) + " bytes."); + } else { + console.log("MIME type table is of expected size " + (endReadPos - mimeListPos) + " bytes."); } return readMimetypeMap(fileArray[0], mimeListPos, endReadPos).then(function(data) { var zf = new ZIMFile(fileArray);