1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Merge pull request #19657 from Snuffleupagus/GenericL10n-rm-regex

Replace the regular expression in `GenericL10n.#getPaths` with simple string parsing
This commit is contained in:
Jonas Jenwald 2025-03-14 16:21:54 +01:00 committed by GitHub
commit 9967ab4aa8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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