fix: ensure font serving does not reflect userdata-derived errors as HTML
Signed-off-by: Michael Nutt <michael@nuttnet.net>
This commit is contained in:
parent
c134795b81
commit
6b3862f34a
3 changed files with 9 additions and 3 deletions
|
|
@ -54,7 +54,10 @@ export const serve_data = {
|
||||||
if (/does not exist/.test(err.message)) {
|
if (/does not exist/.test(err.message)) {
|
||||||
return res.status(204).send();
|
return res.status(204).send();
|
||||||
} else {
|
} else {
|
||||||
return res.status(500).send(err.message);
|
return res
|
||||||
|
.status(500)
|
||||||
|
.header('Content-Type', 'text/plain')
|
||||||
|
.send(err.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ export const serve_font = (options, allowedFonts) => {
|
||||||
res.header('Last-Modified', lastModified);
|
res.header('Last-Modified', lastModified);
|
||||||
return res.send(concated);
|
return res.send(concated);
|
||||||
},
|
},
|
||||||
(err) => res.status(400).send(err),
|
(err) => res.status(400).header('Content-Type', 'text/plain').send(err),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -661,7 +661,10 @@ export const serve_rendered = {
|
||||||
pool.release(renderer);
|
pool.release(renderer);
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return res.status(500).send(err);
|
return res
|
||||||
|
.status(500)
|
||||||
|
.header('Content-Type', 'text/plain')
|
||||||
|
.send(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix semi-transparent outlines on raw, premultiplied input
|
// Fix semi-transparent outlines on raw, premultiplied input
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue