1
0
mirror of https://github.com/Timwi/KtaneWeb.git synced 2024-07-27 03:32:15 +01:00

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

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)}`);