Fix exec web socket/upload/download
This commit is contained in:
@@ -760,12 +760,6 @@ async function startExecWebSocket(req, res, next) {
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
assert.strictEqual(typeof req.params.execId, 'string');
|
||||
|
||||
let cmd = null;
|
||||
if (req.query.cmd) {
|
||||
cmd = safe.JSON.parse(req.query.cmd);
|
||||
if (!Array.isArray(cmd) || cmd.length < 1) return next(new HttpError(400, 'cmd must be array with atleast size 1'));
|
||||
}
|
||||
|
||||
const columns = req.query.columns ? parseInt(req.query.columns, 10) : null;
|
||||
if (isNaN(columns)) return next(new HttpError(400, 'columns must be a number'));
|
||||
|
||||
@@ -777,7 +771,7 @@ async function startExecWebSocket(req, res, next) {
|
||||
// in a badly configured reverse proxy, we might be here without an upgrade
|
||||
if (req.headers['upgrade'] !== 'websocket') return next(new HttpError(404, 'exec requires websocket'));
|
||||
|
||||
const [error, duplexStream] = await safe(apps.startExec(req.app, { cmd: cmd, rows: rows, columns: columns, tty: tty }));
|
||||
const [error, duplexStream] = await safe(apps.startExec(req.app, req.params.execId, { rows, columns, tty }));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
req.clearTimeout();
|
||||
|
||||
Reference in New Issue
Block a user