Skip to content

Invalid busboy behavior on incomplete multipart #73

@thomas-riccardi

Description

@thomas-riccardi

With busboy 0.2.9 when piping an incomplete multipart to busboy the last (incomplete) part is emitted on source end (field emitted, or file stream end emitted), then busboy stops emitting events (no file end, no finish, no error).
It should instead emit an error: the multipart is invalid (because incomplete) and should not emit the current part, because it's not finished.

head commit e70d9e4 fixes part of this issue: now busboy emits an error (Error: Unexpected end of multipart data), but the current incomplete part is still emitted.
For field events we should just not emit them and emit error on busboy.
For file events we should emit error on file, on busboy or on both, I'm not sure which.
Busboy also emits finish, I'm not sure if we want that in addition to the error event.

I'm not sure how to properly handle errors in a pipe involving multiple streams (in my case: http request incoming message, busboy, aws-sdk S3 upload; the S3 upload needs an explicit abort on source error, and the http request needs a reply): busboy readme doesn't show any error handling example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions