mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-17 08:20:10 -04:00
Add secondary URL corrector to increase fidelity of Zimit rendering
This commit is contained in:
parent
a19f740d84
commit
1e047ae985
@ -724,9 +724,16 @@ ZIMArchive.prototype.getDirEntryByPath = function(path, zimitResolving, original
|
||||
if (originalPath) appstate.originalPath = originalPath;
|
||||
path = path.replace(/\?kiwix-display/, '');
|
||||
// Correct obvious errors
|
||||
// if (that._file.zimType === 'zimit' && !zimitResolving) {
|
||||
// path = that._file.minorVersion === 1 ? path.replace(/^.*(C\/A\/.*)$/, '$1') : path.replace(/^.*(A\/.*)$/, '$1');
|
||||
// };
|
||||
if (!originalPath) {
|
||||
var revisedPath = path.replace(/.*?((?:C\/A|A)\/(?!.*(?:C\/A|A)).+)$/, '$1');
|
||||
if (revisedPath !== path) {
|
||||
console.warn('*** Revised path from ' + path + '\nto: ' + revisedPath + ' ***');
|
||||
if (appstate.selectedArchive._file.zimType === 'zimit') {
|
||||
console.debug('*** DEV: Consider correcting this error in tranformZimit.js ***');
|
||||
}
|
||||
path = revisedPath;
|
||||
}
|
||||
}
|
||||
return util.binarySearch(0, this._file.entryCount, function(i) {
|
||||
return that._file.dirEntryByUrlIndex(i).then(function(dirEntry) {
|
||||
var url = dirEntry.namespace + "/" + dirEntry.url;
|
||||
|
Loading…
x
Reference in New Issue
Block a user