diff --git a/src/apps.js b/src/apps.js index 3a2503260..cb99206d1 100644 --- a/src/apps.js +++ b/src/apps.js @@ -2460,10 +2460,12 @@ async function createExec(app, options) { // When passing binary data, tty must be disabled. In addition, the stdout/stderr becomes a single // unified stream because of the nature of a tty (see https://github.com/docker/docker/issues/19696) Tty: options.tty, - Cmd: cmd, - Env: [ 'LANG=C.UTF-8' ] + Cmd: cmd }; + // currently the webterminal and cli sets C.UTF-8 + if (options.lang) createOptions.Env = [ 'LANG=' + options.lang ]; + return await docker.createExec(app.containerId, createOptions); } diff --git a/src/routes/apps.js b/src/routes/apps.js index ccd05e023..4c7dece05 100644 --- a/src/routes/apps.js +++ b/src/routes/apps.js @@ -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 }));