1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-18 14:18:23 +02:00

Replace the regular expression in GenericL10n.#getPaths with simple string parsing

This commit is contained in:
Jonas Jenwald 2025-03-14 15:54:14 +01:00
parent 2294a510b0
commit 9180e27f15

View file

@ -121,7 +121,10 @@ class GenericL10n extends L10n {
const { href } = document.querySelector(`link[type="application/l10n"]`);
const paths = await fetchData(href, /* type = */ "json");
return { baseURL: href.replace(/[^/]*$/, "") || "./", paths };
return {
baseURL: href.substring(0, href.lastIndexOf("/") + 1) || "./",
paths,
};
} catch {}
return { baseURL: "./", paths: Object.create(null) };
}