mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-24 04:54:51 -04:00
parent
11138ff5ca
commit
dcaafb5bbb
@ -387,20 +387,17 @@ ZIMArchive.prototype.findDirEntriesWithPrefix = function (search, callback, noIn
|
|||||||
* @returns {String} The content namespace for the ZIM archive
|
* @returns {String} The content namespace for the ZIM archive
|
||||||
*/
|
*/
|
||||||
ZIMArchive.prototype.getContentNamespace = function () {
|
ZIMArchive.prototype.getContentNamespace = function () {
|
||||||
var errorText;
|
|
||||||
if (this.isReady()) {
|
if (this.isReady()) {
|
||||||
var ver = this.file.minorVersion;
|
var ver = this.file.minorVersion;
|
||||||
// DEV: There are currently only two defined values for minorVersion in the OpenZIM specification
|
// DEV: There are currently only two defined values for minorVersion in the OpenZIM specification
|
||||||
// If this changes, adapt the error checking and return values
|
// If this changes, adapt the error checking and return values
|
||||||
if (ver > 1) {
|
if (ver > 2) {
|
||||||
errorText = 'Unknown ZIM minor version!';
|
console.error('Unknown ZIM minor version: ' + ver + '! Assuming content namespace is C.');
|
||||||
} else {
|
|
||||||
return ver === 0 ? 'A' : 'C';
|
|
||||||
}
|
}
|
||||||
|
return ver === 0 ? 'A' : 'C';
|
||||||
} else {
|
} else {
|
||||||
errorText = 'We could not determine the content namespace because the ZIM file is not ready!';
|
throw new Error('We could not determine the content namespace because the ZIM file is not ready!');
|
||||||
}
|
}
|
||||||
throw new Error(errorText);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user