Skip to content

Commit

Permalink
Returns empty value for issue richardgirges#14
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBurunkov authored Mar 27, 2019
1 parent 204b034 commit acf0f8e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/fileFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ const moveFromBuffer = (filePath, options) => {
};
};

module.exports = (options, fileUploadOptions = null) => {
module.exports = (options, fileUploadOptions = {}) => {
// see: https://github.com/richardgirges/express-fileupload/issues/14
// firefox uploads empty file in case of cache miss when f5ing page.
// resulting in unexpected behavior. if there is no file data, the file is invalid.
if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;

// Create and return file object.
return {
name: options.name,
data: options.buffer,
Expand Down

0 comments on commit acf0f8e

Please sign in to comment.