-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Labels
Description
Summary
parseFormData throws FormDataParseError when processing file uploads with non-ASCII characters in the filename (e.g., Japanese: テスト画像.png).
This issue appears to have been introduced in @remix-run/headers v0.16.0 when SuperHeaders was replaced with the standard Headers class (#10911). It seems to be an unintended side effect of this change.
Affected Versions
@remix-run/form-data-parser>= 0.15.0@remix-run/headers>= 0.16.0@remix-run/multipart-parser>= 0.14.0
Error
FormDataParseError: Cannot parse form data
cause: TypeError: Failed to execute 'append' on 'Headers': String contains non ISO-8859-1 code point.
Root Cause
In #10911, the SuperHeaders class was removed and replaced with parseRawHeaders in @remix-run/headers.
Before:
// packages/multipart-parser/src/lib/multipart.ts
import Headers from '@remix-run/headers'
this.#headers = new Headers(decoder.decode(this.#header))After:
// packages/multipart-parser/src/lib/multipart.ts
import { parse as parseRawHeaders } from '@remix-run/headers'
this.#headers = parseRawHeaders(decoder.decode(this.#header))Steps to Reproduce
- Create a file upload form
- Upload a file with a non-ASCII filename (e.g.,
テスト画像.png,文件.png,파일.png) - Use
parseFormData(request)to parse the request - Observe
FormDataParseError
Expected Behavior
parseFormData should successfully parse file uploads with non-ASCII filenames.
Actual Behavior
parseFormData throws FormDataParseError with cause TypeError: Failed to execute 'append' on 'Headers': String contains non ISO-8859-1 code point.
Reactions are currently unavailable