1
0
Fork 0

Fix redirect page for people who have no preferredManuals in localStorage

This commit is contained in:
Timwi 2024-05-04 09:01:34 +02:00
parent 05faa474b6
commit d40e934326
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@
let inf = JSON.parse(localStorage.getItem('preferredManuals'));
let hash = decodeURIComponent(location.hash.substring(1));
let div = document.getElementById('result');
let redirectTo = hash in inf
let redirectTo = inf && hash in inf
? `${hash} ${inf[hash].replace(/ \((HTML|PDF)\)$/, (_, e) => `.${e.toLowerCase()}`)}`
: `${hash}.html`;
window.location.replace(`../HTML/${encodeURIComponent(redirectTo)}`);