Revert "Update utils.js"

This reverts commit 5de617dfe2.
This commit is contained in:
acalcutt 2025-01-05 02:46:31 -05:00
parent aceb306f14
commit ecfcaeb1a5

View file

@ -223,7 +223,10 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
} }
if (!/^\d+-\d+$/.test(sRange)) { if (!/^\d+-\d+$/.test(sRange)) {
console.error('ERROR: Invalid range: %s', sRange); console.error(
'ERROR: Invalid range: %s',
sanitizedRange.replace(/\n|\r/g, ''),
);
throw new Error('Invalid range'); throw new Error('Invalid range');
} }
@ -239,7 +242,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
} catch (err) { } catch (err) {
console.error( console.error(
'ERROR: Font not found: %s, Error: %s', 'ERROR: Font not found: %s, Error: %s',
filename, filename.replace(/\n|\r/g, ''),
String(err), String(err),
); );
if (fallbacks && Object.keys(fallbacks).length) { if (fallbacks && Object.keys(fallbacks).length) {
@ -259,7 +262,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
console.error( console.error(
`ERROR: Trying to use %s as a fallback for: %s`, `ERROR: Trying to use %s as a fallback for: %s`,
fallbackName, fallbackName,
sFontStack, sanitizedName,
); );
delete fallbacks[fallbackName]; delete fallbacks[fallbackName];
return getFontPbf(null, fontPath, fallbackName, range, fallbacks); return getFontPbf(null, fontPath, fallbackName, range, fallbacks);