utils/image.js: fix getType on local files
This commit is contained in:
parent
0600cf230f
commit
66cf9dc518
2 changed files with 13 additions and 3 deletions
|
@ -20,7 +20,10 @@ app.post("/run", express.json(), async (req, res, next) => {
|
|||
try {
|
||||
let type;
|
||||
if (object.path) {
|
||||
type = object.type ? object.type : await magick.getType(object.path);
|
||||
type = object.type;
|
||||
if (!object.type) {
|
||||
type = await magick.getType(object.path);
|
||||
}
|
||||
if (!type) {
|
||||
return res.sendStatus(400);
|
||||
}
|
||||
|
@ -92,4 +95,4 @@ app.get("/image", (req, res) => {
|
|||
|
||||
app.listen(port, () => {
|
||||
console.log(`Started image API on port ${port}.`);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue