Skip to content

Not getting the full type when parsing multipart/form-data #2283

@jimmywarting

Description

@jimmywarting

Bug Description

Not getting the full type when parsing multipart/form-data

Reproducible By

var b = new Blob(['123'], { type: 'text/plain;charset=utf-8'})
var fd = new FormData()
fd.set('x', b)
var res = new Response(fd)
res.clone().text().then(body => 
  // Just making sure that it contains ;charset=utf-8 (which it dose)
  console.log(body.includes('utf-8'))
)

new Response(fd).formData().then(fd => {
  // returns just 'text/plain'
  console.log(fd.get('x').type)
})

Expected Behavior

To get the full type, text/plain;charset=utf-8

Logs & Screenshots

Screenshot of chrome:
image

Screenshot of NodeJS
image

Environment

Not using undici directly - using Node.js v20.6.1 built in fetch

Additional context

presumable this revolves around the usage around Busboy...
Maybe the type should be extracted from the headers instead...? to get the raw content-type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions