-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File.resume() docx file busboy finish event #191
Comments
Hi. Think I just solve it, still doing some tests. Calling file.resume() on next tick do the trick. function readFirstBytes() {
console.log("readFirstBytes...")
var chunk = file.read(fileType.minimumBytes);
if (!chunk) return file.once('readable', readFirstBytes);
const type = fileType(chunk);
let ext = "foo";
if (type) ext = type.ext
file.unshift(chunk);
if (ext === 'jpeg' || ext === 'jpg' || ext === 'png') {
console.log("checkExtention allow ---> ", ext)
file.pipe(fs.createWriteStream('./' + filename));
} else {
console.log('Rejected file of type ' + ext);
process.nextTick(function() {
file.resume().on('end', () => {
console.log('Reached the end, but did not read anything.');
});
});
} |
I think this is a bug in node v10.x. node v8.x and node master currently work as you're expecting. |
Upstream bug report: nodejs/node#25642 |
Thanks for your responses @mscdex appreciate it. |
Alright as noted in the upstream issue, this should've been fixed in node v10.15.1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
In order to discard not allowed extensions I use file.resume() to get off not allowed files and let start with another or finish the form upload.
All went smooth until some type of .docx knock my door.
The problem is when we upload this type of file, Busboy never gets finish signal and browser connection hangs until time out, with other not allowed files they get rejected, Busboy knows when the upload finished.
Busboy version:
To reproduce this behaviour:
-Server Output:
I can upload other doc or docx files and they get rejected and busboy.on('finish') gets executed:
-Server Output:
server.js
Thanks for reading.
The text was updated successfully, but these errors were encountered: