fix: ci sprite issue
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
parent
37857c337c
commit
4bc80eea48
1 changed files with 19 additions and 19 deletions
|
@ -63,9 +63,10 @@ export const serve_style = {
|
||||||
const scale = req.params.scale || '';
|
const scale = req.params.scale || '';
|
||||||
const format = req.params.format;
|
const format = req.params.format;
|
||||||
const item = repo[req.params.id];
|
const item = repo[req.params.id];
|
||||||
|
console.log(scale);
|
||||||
|
|
||||||
let spritePath;
|
let spritePath;
|
||||||
if (item && !item.spritePaths) {
|
if (item && item.spritePaths) {
|
||||||
for (const sprite of item.spritePaths) {
|
for (const sprite of item.spritePaths) {
|
||||||
if (sprite.name === name) {
|
if (sprite.name === name) {
|
||||||
spritePath = sprite.path;
|
spritePath = sprite.path;
|
||||||
|
@ -85,9 +86,6 @@ export const serve_style = {
|
||||||
spriteScale = as;
|
spriteScale = as;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!spriteScale) {
|
|
||||||
return res.sendStatus(400);
|
|
||||||
}
|
|
||||||
|
|
||||||
let spriteFormat;
|
let spriteFormat;
|
||||||
const allowedFormats = ['png', 'json'];
|
const allowedFormats = ['png', 'json'];
|
||||||
|
@ -96,11 +94,10 @@ export const serve_style = {
|
||||||
spriteFormat = af;
|
spriteFormat = af;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!spriteFormat) {
|
|
||||||
return res.sendStatus(400);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (spriteFormat) {
|
||||||
const filename = `${spritePath + spriteScale}.${spriteFormat}`;
|
const filename = `${spritePath + spriteScale}.${spriteFormat}`;
|
||||||
|
console.log(filename);
|
||||||
// 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) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -113,6 +110,9 @@ export const serve_style = {
|
||||||
return res.send(data);
|
return res.send(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return res.sendStatus(400);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue