mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 12:19:46 -04:00
parent
bb8a661933
commit
6792996ec4
@ -90,7 +90,9 @@ function getZimitRedirect (dirEntry, data, cns) {
|
|||||||
} else if (/301\s*moved\s+permanently/i.test(data)) {
|
} else if (/301\s*moved\s+permanently/i.test(data)) {
|
||||||
redirect = data.match(/moved\s+permanently(?:[^<]|<(?!a\s))+<a\s[^"']+["'](?:https?:)?\/?\/?([^"']+)/i);
|
redirect = data.match(/moved\s+permanently(?:[^<]|<(?!a\s))+<a\s[^"']+["'](?:https?:)?\/?\/?([^"']+)/i);
|
||||||
if (redirect && redirect[1]) {
|
if (redirect && redirect[1]) {
|
||||||
dirEntry.zimitRedirect = cns + '/' + (cns === 'C' ? 'A/' : '') + redirect[1];
|
// Remove any port
|
||||||
|
var zimitRedirect = redirect[1].replace(/^([^/]+):\d+(\/)/, '$1$2');
|
||||||
|
dirEntry.zimitRedirect = cns + '/' + (cns === 'C' ? 'A/' : '') + zimitRedirect;
|
||||||
}
|
}
|
||||||
console.debug('*** Asset moved permanently! Redirecting to: ' + dirEntry.zimitRedirect + ' ***');
|
console.debug('*** Asset moved permanently! Redirecting to: ' + dirEntry.zimitRedirect + ' ***');
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user