Set exec LANG via rest API only

This commit is contained in:
Johannes Zellner
2022-11-16 16:08:54 +01:00
parent 013e15e361
commit 0b6bbf4cc2
2 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -728,9 +728,11 @@ async function createExec(req, res, next) {
if ('tty' in req.body && typeof req.body.tty !== 'boolean') return next(new HttpError(400, 'tty must be boolean'));
const tty = !!req.body.tty;
if ('lang' in req.body && typeof req.body.lang !== 'string') return next(new HttpError(400, 'lang must be a string'));
if (safe.query(req.app, 'manifest.addons.docker') && req.user.role !== users.ROLE_OWNER) return next(new HttpError(403, '"owner" role is requied to exec app with docker addon'));
const [error, id] = await safe(apps.createExec(req.app, { cmd, tty }));
const [error, id] = await safe(apps.createExec(req.app, { cmd, tty, lang: req.body.lang }));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { id }));