Skip to content

Fix multipart boundaries containing equals signs#1400

Open
raashish1601 wants to merge 1 commit into
expressjs:mainfrom
raashish1601:codex/allow-equals-boundary
Open

Fix multipart boundaries containing equals signs#1400
raashish1601 wants to merge 1 commit into
expressjs:mainfrom
raashish1601:codex/allow-equals-boundary

Conversation

@raashish1601

Copy link
Copy Markdown

Fixes #1051.

Multer used type-is to detect multipart requests before handing the request to Busboy. type-is rejects unquoted multipart boundary parameters containing =, even though those boundaries can be parsed by the multipart stream itself. The result was that Multer skipped the request entirely.

This changes the early multipart check to avoid parsing parameters and only inspect the media type while still honoring type-is.hasBody(req). Before constructing Busboy, it normalizes only unquoted boundary values containing = by quoting the boundary in the headers passed to Busboy. The original request headers are not mutated.

Validation:

  • npx mocha --reporter spec --exit --check-leaks test/fields.js
  • npm run lint
  • npm test was also run; it still fails on existing Windows fixture-size/path assertions unrelated to this change, while the new fields regression passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multer skips the request, when boundary contains an equal sign "="

1 participant