fixed some bugs
This commit is contained in:
+8
-2
@@ -153,8 +153,13 @@ app.post('/dir', async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
if (!req.fobj) return res.sendStatus(401);
|
if (!req.fobj) return res.sendStatus(401);
|
||||||
|
|
||||||
const { fpath, deep } = req.fobj,
|
const { fpath, deep } = req.fobj;
|
||||||
filesInDir = await client.getDirectoryContents(fpath, {
|
if (!fpath) return res.sendStatus(400);
|
||||||
|
else if (!(await client.exists(fpath)) {
|
||||||
|
return res.status(404).send("Directory not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const filesInDir = await client.getDirectoryContents(fpath, {
|
||||||
deep
|
deep
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -162,6 +167,7 @@ app.post('/dir', async (req, res) => {
|
|||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
res.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user