mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-18 08:47:35 -04:00
Correct logic in readMimetypeMap
Former-commit-id: 7fc133d955ba0036603463b51048d4d7d1d888fe [formerly 71960e6b7fbeeab81825dbb4e6972d6d8a3fd419] Former-commit-id: 8eca8168046f7370624c1e963febf2dc9647483b
This commit is contained in:
parent
4ad637723a
commit
3c350f5fcd
@ -224,7 +224,7 @@ define(['xzdec_wrapper', 'util', 'utf8', 'q', 'zimDirEntry'], function(xz, util,
|
|||||||
var size = urlPtrPos - mimeListPos;
|
var size = urlPtrPos - mimeListPos;
|
||||||
return util.readFileSlice(file, mimeListPos, size).then(function(data) {
|
return util.readFileSlice(file, mimeListPos, size).then(function(data) {
|
||||||
if (data.subarray) {
|
if (data.subarray) {
|
||||||
var i = 1;
|
var i = 0;
|
||||||
var pos = -1;
|
var pos = -1;
|
||||||
var mimeString;
|
var mimeString;
|
||||||
while (pos < size) {
|
while (pos < size) {
|
||||||
@ -270,15 +270,15 @@ define(['xzdec_wrapper', 'util', 'utf8', 'q', 'zimDirEntry'], function(xz, util,
|
|||||||
var mimeListPos = readInt(header, 56, 8);
|
var mimeListPos = readInt(header, 56, 8);
|
||||||
var urlPtrPos = readInt(header, 32, 8);
|
var urlPtrPos = readInt(header, 32, 8);
|
||||||
return readMimetypeMap(fileArray[0], mimeListPos, urlPtrPos).then(function(data) {
|
return readMimetypeMap(fileArray[0], mimeListPos, urlPtrPos).then(function(data) {
|
||||||
var zf = new ZIMFile(fileArray);
|
var zf = new ZIMFile(fileArray);
|
||||||
zf.articleCount = readInt(header, 24, 4);
|
zf.articleCount = readInt(header, 24, 4);
|
||||||
zf.clusterCount = readInt(header, 28, 4);
|
zf.clusterCount = readInt(header, 28, 4);
|
||||||
zf.urlPtrPos = urlPtrPos;
|
zf.urlPtrPos = urlPtrPos;
|
||||||
zf.titlePtrPos = readInt(header, 40, 8);
|
zf.titlePtrPos = readInt(header, 40, 8);
|
||||||
zf.clusterPtrPos = readInt(header, 48, 8);
|
zf.clusterPtrPos = readInt(header, 48, 8);
|
||||||
zf.mimeListPos = mimeListPos;
|
zf.mimeListPos = mimeListPos;
|
||||||
zf.mainPage = readInt(header, 64, 4);
|
zf.mainPage = readInt(header, 64, 4);
|
||||||
zf.layoutPage = readInt(header, 68, 4);
|
zf.layoutPage = readInt(header, 68, 4);
|
||||||
zf.mimeTypes = data;
|
zf.mimeTypes = data;
|
||||||
return zf;
|
return zf;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user