mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-11-25 14:57:21 +01:00
fix(backend): ファイルがサイズの制限を超えてアップロードされた際にエラーを返さなかった問題を修正
This commit is contained in:
parent
1008fa32a0
commit
f85aa7b641
2 changed files with 10 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
||||||
-
|
-
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
-
|
- ファイルがサイズの制限を超えてアップロードされた際にエラーを返さなかった問題を修正
|
||||||
|
|
||||||
|
|
||||||
## 2024.8.0
|
## 2024.8.0
|
||||||
|
|
|
@ -199,9 +199,17 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [path] = await createTemp();
|
const [path, cleanup] = await createTemp();
|
||||||
await stream.pipeline(multipartData.file, fs.createWriteStream(path));
|
await stream.pipeline(multipartData.file, fs.createWriteStream(path));
|
||||||
|
|
||||||
|
// ファイルサイズが制限を超えていた場合
|
||||||
|
if (multipartData.file.truncated) {
|
||||||
|
cleanup();
|
||||||
|
reply.code(413);
|
||||||
|
reply.send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fields = {} as Record<string, unknown>;
|
const fields = {} as Record<string, unknown>;
|
||||||
for (const [k, v] of Object.entries(multipartData.fields)) {
|
for (const [k, v] of Object.entries(multipartData.fields)) {
|
||||||
fields[k] = typeof v === 'object' && 'value' in v ? v.value : undefined;
|
fields[k] = typeof v === 'object' && 'value' in v ? v.value : undefined;
|
||||||
|
|
Loading…
Reference in a new issue