Skip to content

Commit

Permalink
Merge pull request #241 from nusu/remove-empty-files
Browse files Browse the repository at this point in the history
Remove empty files
  • Loading branch information
richardgirges authored Aug 14, 2020
2 parents 4fa3bf9 + 8716fd6 commit 6458793
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/processMultipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ module.exports = (options, req, res, next) => {
// Do not add file instance to the req.files if original name and size are empty.
// Empty name and zero size indicates empty file field in the posted form.
if (!name && size === 0) {
if (options.useTempFiles) {
cleanup();
debugLog(options, `Removing the empty file ${field}->${filename}`);
}
return debugLog(options, `Don't add file instance if original name and size are empty`);
}
req.files = buildFields(req.files, field, fileFactory({
Expand Down

0 comments on commit 6458793

Please sign in to comment.