files null check

This commit is contained in:
Erik 2023-05-03 23:06:40 +03:00
parent c44fb4ebfa
commit a29f280af1
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -90,6 +90,8 @@ class UserEndpoint extends ApiEndpoint {
async uploadAvatar (req: Request, res: Response): Promise<void> { async uploadAvatar (req: Request, res: Response): Promise<void> {
const { user, files } = req; const { user, files } = req;
if (!files)
return void res.status(400).send('Missing file');
const { file } = files; const { file } = files;
if (!file) if (!file)