fix: only accept files upload with files[] field

was always supposed to only accept said field, but i forgot to include
the logic during migration from expressjs to hyper-express
This commit is contained in:
Bobby 2022-08-24 04:17:07 +07:00
parent 14a340922c
commit 6ad8ed7ae6
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09

View File

@ -338,6 +338,10 @@ self.actuallyUpload = async (req, res, data = {}) => {
// Process files immediately and push into Request.files array
if (field.file) {
if (field.name !== 'files[]') {
throw new ClientError(`Unexpected file-type field: ${field.name}`)
}
// Push immediately as we will only be adding props into the file object down the line
const file = {
albumid: data.albumid,