mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
fix(core): profile avatar upload should not return 400 error (#5974)
This commit is contained in:
parent
391717637c
commit
14515f2c44
1 changed files with 4 additions and 2 deletions
|
@ -57,13 +57,15 @@ export default function userAssetsRoutes<T extends AuthedMeRouter>(...[router]:
|
|||
'/user-assets',
|
||||
koaGuard({
|
||||
files: object({
|
||||
file: uploadFileGuard,
|
||||
file: uploadFileGuard.array().min(1),
|
||||
}),
|
||||
response: userAssetsGuard,
|
||||
}),
|
||||
async (ctx, next) => {
|
||||
const { file } = ctx.guard.files;
|
||||
const { file: bodyFiles } = ctx.guard.files;
|
||||
|
||||
const file = bodyFiles[0];
|
||||
assertThat(file, 'guard.invalid_input');
|
||||
assertThat(file.size <= maxUploadFileSize, 'guard.file_size_exceeded');
|
||||
assertThat(
|
||||
allowUploadMimeTypes.map(String).includes(file.mimetype),
|
||||
|
|
Loading…
Add table
Reference in a new issue