aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2022-02-14 16:04:56 -0600
committerMatt Strapp <matt@mattstrapp.net>2022-02-14 16:04:56 -0600
commitc90893ec688a7cc2fa31b0dee4e4964fd3a8a968 (patch)
treece4ef1f9e262f88ed0cfe47d0f17369370a9245a
parentreplace exec with spawn (diff)
downloadee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.tar
ee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.tar.gz
ee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.tar.bz2
ee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.tar.lz
ee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.tar.xz
ee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.tar.zst
ee4511w-web-c90893ec688a7cc2fa31b0dee4e4964fd3a8a968.zip
change some 403s to 400s
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
-rw-r--r--src/routes/api.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/routes/api.ts b/src/routes/api.ts
index eb20963..bae30b0 100644
--- a/src/routes/api.ts
+++ b/src/routes/api.ts
@@ -73,17 +73,17 @@ api.route('/actuate')
try {
await access(req.body.path);
} catch (err) {
- return res.status(403).json({ error: 'File is not accessible.' });
+ return res.status(403).json({ error: 'File is not accessible or does not exist.' });
}
const stats = await stat(req.body.path);
// Make sure the file being requested to run is a regular file
if (!stats.isFile())
- return res.status(403).json({ error: 'File is not a regular file.' });
+ return res.status(400).json({ error: 'File is not a regular file.' });
// Make sure the file being requested to run is not a directory
if (stats.isDirectory())
- return res.status(403).json({ error: 'File is a directory.' });
+ return res.status(400).json({ error: 'File is a directory.' });
const escaped = quote( [ req.body.path ] );
// Run the code