Skip to content

Commit 507965c

Browse files
committed
core: fix command send
1 parent fdbb36e commit 507965c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/server/handler/commands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-empty-pattern */
22
/* eslint-disable no-await-in-loop */
33
import { Context } from 'cordis';
4-
import { param, Types } from '@hydrooj/framework';
4+
import { BadRequestError } from '@hydrooj/framework';
55
import { config } from '../config';
66
import { executeOnHost } from '../utils';
77
import { AuthHandler } from './misc';
@@ -11,8 +11,8 @@ class CommandsHandler extends AuthHandler {
1111
this.response.body = '';
1212
}
1313

14-
@param('command', Types.String)
15-
async postCommand({ }, command: string) {
14+
async postCommand({ command }) {
15+
if (!command || typeof command !== 'string') throw new BadRequestError('Command', null, 'Command is required');
1616
this.response.body = this.executeForAll(command);
1717
}
1818

0 commit comments

Comments
 (0)