unjs / h3

⚡️ Minimal H(TTP) framework built for high performance and portability

Home Page:https://h3.unjs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The readMultipartFormData function returns a buffer and does not function properly if the form contains a file.

Ray0907 opened this issue · comments

Environment


  • Operating System: Darwin
  • Node Version: v18.19.0
  • Nuxt Version: 3.10.3
  • CLI Version: 3.10.1
  • Nitro Version: 2.9.3
  • Package Manager: pnpm@8.15.4
  • Builder: -
  • User Config: runtimeConfig, app, vite, nitro, modules, auth, i18n, dayjs, routeRules, security
  • Runtime Modules: @sidebase/nuxt-auth@0.6.7, @nuxtjs/i18n@8.1.1, dayjs-nuxt@2.1.9, nuxt-security@0.14.4
  • Build Modules: -

Reproduction

As described subsequently

Describe the bug

According to the documentation at https://h3.unjs.io/utils/request#readmultipartformdataevent, the object should consist of key-value pairs from FormData. However, I received this response: { name: 'NAME', data: <Buffer > }. When I attempted to add file upload, it crashed. I previously used formidable to parse the file, but encountered issues with the callback not working. Therefore, I attempted to use readMultipartFormData to handle the FormData, but still encountered errors.

Additional context

No response

Logs

No response