mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Cleanup req files on bad request
This commit is contained in:
parent
c487d3033c
commit
cf7a61b5a2
9 changed files with 50 additions and 22 deletions
|
@ -4,6 +4,7 @@ import { isAvatarFile } from '../../helpers/custom-validators/users'
|
|||
import { areValidationErrors } from './utils'
|
||||
import { CONSTRAINTS_FIELDS } from '../../initializers'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { cleanUpReqFiles } from '../../helpers/utils'
|
||||
|
||||
const updateAvatarValidator = [
|
||||
body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage(
|
||||
|
@ -14,7 +15,7 @@ const updateAvatarValidator = [
|
|||
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
logger.debug('Checking updateAvatarValidator parameters', { files: req.files })
|
||||
|
||||
if (areValidationErrors(req, res)) return
|
||||
if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
|
||||
|
||||
return next()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue