fix: try to fix some codeql errors
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
parent
bae0d10799
commit
6f9199556e
1 changed files with 2 additions and 4 deletions
|
@ -60,7 +60,7 @@ export const serve_style = {
|
||||||
'/:id/sprite(/:name)?:scale(@[23]x)?.:format([\\w]+)',
|
'/:id/sprite(/:name)?:scale(@[23]x)?.:format([\\w]+)',
|
||||||
(req, res, next) => {
|
(req, res, next) => {
|
||||||
const name = req.params.name || 'sprite';
|
const name = req.params.name || 'sprite';
|
||||||
const scale = req.params.scale || '';
|
const scale = req.params.scale.replace(/[^@23x]/g, '') || '';
|
||||||
const format = req.params.format;
|
const format = req.params.format;
|
||||||
const item = repo[req.params.id];
|
const item = repo[req.params.id];
|
||||||
|
|
||||||
|
@ -81,9 +81,7 @@ export const serve_style = {
|
||||||
|
|
||||||
const filename = `${spritePath + scale}.${format}`;
|
const filename = `${spritePath + scale}.${format}`;
|
||||||
if (format !== 'png' && format !== 'json') {
|
if (format !== 'png' && format !== 'json') {
|
||||||
return res
|
return res.sendStatus(400);
|
||||||
.sendStatus(400)
|
|
||||||
.send('Invalid format. Please use png or json.');
|
|
||||||
} else {
|
} else {
|
||||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||||
return fs.readFile(filename, (err, data) => {
|
return fs.readFile(filename, (err, data) => {
|
||||||
|
|
Loading…
Reference in a new issue