Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get "TypeError: Invalid character in header content ["Content-Disposition"]" when handling an UTF8 named file #30

Open
VishnuSanyal opened this issue Nov 24, 2024 · 3 comments

Comments

@VishnuSanyal
Copy link

When I use Remix action to process a file uploaded by a client that contains non-ASCII characters for naming, I get the error:

TypeError: Invalid character in header content ["Content-Disposition"]
    at Proxy.<anonymous> ([PROJECTDIR]\node_modules\.pnpm\@[email protected]\node_modules\@remix-run\web-fetch\src\headers.js:121:8)
    at new _SuperHeaders ([PROJECTDIR]/node_modules/.pnpm/@[email protected]/node_modules/@mjackson/headers/dist/headers.js:621:18)
    at MultipartPart.get headers [as headers] ([PROJECTDIR]/node_modules/.pnpm/@[email protected]/node_modules/@mjackson/multipart-parser/dist/multipart-parser.js:348:23)
    at MultipartPart.get name [as name] ([PROJECTDIR]/node_modules/.pnpm/@[email protected]/node_modules/@mjackson/multipart-parser/dist/multipart-parser.js:374:17)
    at parseFormData ([PROJECTDIR]/node_modules/.pnpm/@[email protected]/node_modules/@mjackson/form-data-parser/dist/form-data-parser.js:51:17)    
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at action$5 ([PROJECTDIR]/build/server/index.js?t=1732423388940.4094:7422:5)
    at Object.callRouteAction ([PROJECTDIR]\node_modules\.pnpm\@[email protected][email protected]\node_modules\@remix-run\server-runtime\dist\data.js:36:16)
    at [PROJECTDIR]\node_modules\.pnpm\@[email protected]\node_modules\@remix-run\router\router.ts:4899:19
    at callLoaderOrAction ([PROJECTDIR]\node_modules\.pnpm\@[email protected]\node_modules\@remix-run\router\router.ts:4963:16) {
  code: 'ERR_INVALID_CHAR'
}
@mjackson
Copy link
Owner

Interesting. Any interest in providing a failing test case? I'd be happy to take a look.

@wong2
Copy link

wong2 commented Dec 23, 2024

Same here. This error shows up when I upload a file with a Chinese name.

@wong2
Copy link

wong2 commented Dec 24, 2024

I think the problem is, why it is still using the headers from @remix-run/web-fetch instead of the built-in Node.js ones, even after enabling v3_singleFetch?

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

No branches or pull requests

3 participants