-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
after enter an Error in fileFilter,it doesn't work #192
Comments
Hmm, I think that this is the same bug as in #168. I really need to get this fixed, hopefully I can get at least a workaround commited when I get home tonight. Thank you for your patience. |
Thank you 👍 I don't have time to try anything at the moment, but if you want to experiment a bit, this is the lines where I think we need to change something: lib/make-middleware.js L36-42 When we Maybe something like this could work: function done (err) {
if (isDone) return
isDone = true
- req.unpipe(busboy)
busboy.removeAllListeners()
- next(err)
+ busboy.on('finish', function () {
+ next(err)
+ })
} |
@LinusU it doesn't work,and the line 'next(err)' in callback is not went into. |
Should be fixed by dfa2095, please reopen if issue persists. |
@LinusU My problem is not about file size limit,and that don't fit me. when I throw a error at FileFilter, line 95 in the make-middleware.js is ran into.
|
Oh shit, I thought that it would be solved by that same bug. I'll take another look at this. |
@zyf0330 Could you try the following in make-middleware.js L95-98 if (err) {
appender.removePlaceholder(placeholder)
+ fileStream.resume()
return abortWithError(err)
} |
@LinusU it doesn't work too.What happened is that chrome shows the file is uploading after the error has been handled,and the progress keeps 14% all the time. So uploading stream needs to be closed,is it? |
Hmm, could you try adding this in addition to the change that you already made. function done (err) {
if (isDone) return
isDone = true
req.unpipe(busboy)
+ req.resume()
busboy.removeAllListeners()
next(err)
} |
it can't do.uploading is continuing |
I write req.on('end') before req.resume(),but it can not run into. |
Okay, I'm pretty sure that this is a bug in Node.js itself 😭 |
I will put my eye on this issue. |
Possible fix here: nodejs/node#2323. Haven't had the time to test yet thought... |
Let me have a look.wait. |
I change _stream_readable.js like the fix #2323 above,but nothing runs into lines which are changed and result is the same. |
You still need this change to multer (I think), might be something more thought... function done (err) {
if (isDone) return
isDone = true
req.unpipe(busboy)
+ req.resume()
busboy.removeAllListeners()
next(err)
} |
Could you tell me if I should alter the multer\node_modules\busboy\node_modules\readable-stream\lib_stream_readable.js? |
Hmm, I don't think so. It should be the stream from the builtin |
Do you mean I need to alter that file and compile nodejs.exe? |
I'm not sure on the specifics but, yeah, probably. That's why it's a bit of a pain to test it... |
That is a challenge for me...I think I need to think about it . |
I will at Monday. |
This should be fixed by #205 and released on npm as version Please reopen if issue persists. |
I still have this issue. I am using multer 1.0.6 and node 0.12.7 i've got
the function executes, but request goes Pending in Chrome, |
@tibortru May you can try node v4.0 version. |
@zyf0330 Ye, same thing... I actually don't know how I got this ancient version of Node installed... but after I reinstalled node to version 4.1.2 I still have same issue... Do I explicitly need 4.0 version of node? EDIT: I have tried it on another PC where I got node 4.1.1 , still same issue |
guys is there a way to get res object inside fileFilter function arguments? |
Why would you need that? It's purposely not included since you shouldn't respond to the request from the fileFilter function... Interested to hear your use case |
This line within 'new Error' works not well.
Though
has been executed in app.js error handle,but the page shows it is uploading file.
The text was updated successfully, but these errors were encountered: