Update serve_font.js
This commit is contained in:
parent
e79e011ae8
commit
dce7732716
1 changed files with 7 additions and 5 deletions
|
@ -30,8 +30,12 @@ export async function serve_font(options, allowedFonts, programOpts) {
|
|||
* @returns {Promise<void>}
|
||||
*/
|
||||
app.get('/fonts/:fontstack/:range.pbf', async (req, res) => {
|
||||
const sFontStack = String(req.params.fontstack).replace(/\n|\r/g, '');
|
||||
const sRange = String(req.params.range).replace(/\n|\r/g, '');
|
||||
const sFontStack = String(decodeURI(req.params.fontstack)).replace(
|
||||
/\n|\r/g,
|
||||
'',
|
||||
);
|
||||
|
||||
if (verbose) {
|
||||
console.log(
|
||||
`Handling font request for: /fonts/%s/%s.pbf`,
|
||||
|
@ -50,14 +54,12 @@ export async function serve_font(options, allowedFonts, programOpts) {
|
|||
}
|
||||
}
|
||||
|
||||
const fontstack = decodeURI(req.params.fontstack);
|
||||
const range = req.params.range;
|
||||
try {
|
||||
const concatenated = await getFontsPbf(
|
||||
options.serveAllFonts ? null : allowedFonts,
|
||||
fontPath,
|
||||
fontstack,
|
||||
range,
|
||||
sFontStack,
|
||||
sRange,
|
||||
existingFonts,
|
||||
);
|
||||
res.header('Content-type', 'application/x-protobuf');
|
||||
|
|
Loading…
Reference in a new issue