More readable diagnostics

Former-commit-id: d76a01364aaa44b01c372b35f6b1024e05cac1d5 [formerly 8b3568396e7d91b21fdf5f93815fc8a4384b1e72]
Former-commit-id: c3b421c0fb07cead8301b37327be95ccd17cc49c
This commit is contained in:
Jaifroid 2020-06-29 10:13:38 +01:00
parent 3c67d6bc0f
commit d0939b86ab

View File

@ -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);