Compare commits

...

2 Commits

Author SHA1 Message Date
Jonas Jenwald
9967ab4aa8
Merge pull request #19657 from Snuffleupagus/GenericL10n-rm-regex
Replace the regular expression in `GenericL10n.#getPaths` with simple string parsing
2025-03-14 16:21:54 +01:00
Jonas Jenwald
9180e27f15 Replace the regular expression in GenericL10n.#getPaths with simple string parsing 2025-03-14 15:54:14 +01:00

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