make font regex less restrictive

This commit is contained in:
acalcutt 2025-01-10 15:15:05 -05:00
parent 5315123d96
commit 930e5719c7

View file

@ -260,7 +260,7 @@ export function readFile(filename) {
*/
async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
if (!allowedFonts || (allowedFonts[name] && fallbacks)) {
const fontMatch = name?.match(/^[\w\s-]+$/);
const fontMatch = name?.match(/^[\p{L}\p{N} \-\.~!*\'()@&=+,#$\[\]]+$/u);
const sanitizedName = fontMatch?.[0] || 'invalid';
if (!name || typeof name !== 'string' || name.trim() === '' || !fontMatch) {
console.error(