fix: Ensure font serving does not reflect userdata-derived errors as HTML (#647)
* 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:
+4
-1
@@ -54,7 +54,10 @@ export const serve_data = {
|
||||
if (/does not exist/.test(err.message)) {
|
||||
return res.status(204).send();
|
||||
} else {
|
||||
return res.status(500).send(err.message);
|
||||
return res
|
||||
.status(500)
|
||||
.header('Content-Type', 'text/plain')
|
||||
.send(err.message);
|
||||
}
|
||||
} else {
|
||||
if (data == null) {
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ export const serve_font = (options, allowedFonts) => {
|
||||
res.header('Last-Modified', lastModified);
|
||||
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);
|
||||
if (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
|
||||
|
||||
Reference in New Issue
Block a user