Closed koprda closed 4 years ago
That is strange. Can you turn module's debug output on and share it.
I was able to reproduce it.
Looking into this.
In case of in-memory upload this PR #15 affects empty file uploads. @r3wt , could you please elaborate #14 issue?
Since we already have the following check in processMultipart:
// 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) return;
Do we still need that check in fileFactory:
// 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;
I've commented
if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;
And it looks checks in processMultipart do the job, so if I reproduced those issue correct, probably we can consider removing check in fileFactory.
@RomanBurunkov Maybe. I'm not actually sure, we might have to summon Richard to see if he knows. This was so long ago I barely remember it.
Hi @richardgirges , do you remember anything about issue #14 and PR #15. I can't figure out steps how to could be reproduced.
Fixed with PR #233
I tried it, this doesn't seem fixed I'm going to fix it and push a following PR, can you open the issue @RomanBurunkov
edit: sorry I misread the issue, nothing wrong with the fix though it creates an empty file while it shouldn't I created a PR for that #241
uploading "empty" zero-length file end with error in both modes memory and temp file
simple reproduction - truncate test file basketball.png and run test