Skip to content

Commit e94ef2b

Browse files
taylortomclaude
andcommitted
Fix: Correct inverted file size validation check
The negation operator was applied to f.size instead of the comparison, causing the size check to always evaluate as truthy. Files exceeding maxFileSize were never rejected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fa04e54 commit e94ef2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/MiddlewareModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async function validateUploadedFiles (req, filesObj, options) {
269269
assetErrors.push(errors.UNEXPECTED_FILE_TYPES.setData({ expectedFileTypes: options.expectedFileTypes, invalidFiles: [f.originalFilename], mimetypes: [f.mimetype] }))
270270
}
271271
}
272-
if (!f.size > options.maxFileSize) {
272+
if (f.size > options.maxFileSize) {
273273
assetErrors.push(errors.FILE_EXCEEDS_MAX_SIZE.setData({ size: bytes(f.size), maxSize: bytes(options.maxFileSize) }))
274274
}
275275
}))

0 commit comments

Comments
 (0)