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