mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
framework: allow empty file upload
This commit is contained in:
3 files changed
+7
-5
No files matched your search
@@ -190,7 +190,7 @@ export class ApiHandler<C extends Context> extends Handler<C> {
|
||||
if (!['get', 'post'].includes(this.request.method.toLowerCase())) {
|
||||
throw new MethodNotAllowedError(this.request.method);
|
||||
}
|
||||
if (!APIS[op]) throw new BadRequestError('Invalid operation');
|
||||
if (!APIS[op]) throw new BadRequestError(`Invalid API operation: ${op}`);
|
||||
if (APIS[op].type === 'Subscription') {
|
||||
throw new BadRequestError('Subscription operation cannot be called in HTTP handler');
|
||||
}
|
||||
@@ -226,7 +226,7 @@ export class ApiConnectionHandler<C extends Context> extends ConnectionHandler<C
|
||||
this.isRpc = true;
|
||||
return;
|
||||
}
|
||||
if (!APIS[op]) throw new BadRequestError('Invalid operation');
|
||||
if (!APIS[op]) throw new BadRequestError(`Invalid API operation: ${op}`);
|
||||
if (APIS[op].type !== 'Subscription') {
|
||||
throw new BadRequestError('Only subscription operations are supported');
|
||||
}
|
||||
@@ -250,7 +250,7 @@ export class ApiConnectionHandler<C extends Context> extends ConnectionHandler<C
|
||||
throw new BadRequestError('Invalid message');
|
||||
}
|
||||
}
|
||||
if (!APIS[message.op]) throw new BadRequestError('Invalid operation');
|
||||
if (!APIS[message.op]) throw new BadRequestError(`Invalid API operation: ${message.op}`);
|
||||
if (APIS[message.op].type !== 'Subscription') {
|
||||
throw new BadRequestError('Only subscription operations are supported');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/framework",
|
||||
"version": "0.2.4",
|
||||
"version": "0.2.5",
|
||||
"main": "index.ts",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/hydro-dev/Hydro",
|
||||
@@ -13,7 +13,7 @@
|
||||
"@mongodb-js/saslprep": "^1.3.2",
|
||||
"emoji-regex": "^10.6.0",
|
||||
"fs-extra": "^11.3.2",
|
||||
"koa": "^3.0.3",
|
||||
"koa": "^3.1.1",
|
||||
"koa-body": "^7.0.0",
|
||||
"koa-compress": "^5.1.1",
|
||||
"path-to-regexp": "^8.3.0",
|
||||
|
||||
@@ -412,6 +412,8 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
formLimit: '8mb',
|
||||
formidable: {
|
||||
uploadDir,
|
||||
allowEmptyFiles: true,
|
||||
minFileSize: 0,
|
||||
maxFileSize: parseMemoryMB(this.config.upload) * 1024 * 1024,
|
||||
keepExtensions: true,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user