Problems with UTF characters
djotto opened this issue · 0 comments
djotto commented
I think serve-handler isn't implementing RFC 5987 correctly.
When I attempt to serve a file with the name DALL·E 2024-01-17.png
(note the bullet point) I get the following error:
$ node server.js
Server running at http://localhost:3000/
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Content-Disposition"]
at storeHeader (node:_http_outgoing:580:5)
at processHeader (node:_http_outgoing:575:3)
at ServerResponse._storeHeader (node:_http_outgoing:451:11)
at ServerResponse.writeHead (node:_http_server:422:8)
at module.exports (/Users/djotto/projects/test-serve-handler/node_modules/serve-handler/src/index.js:754:11) {
code: 'ERR_INVALID_CHAR'
}
Node.js v20.5.1
I put together a minimal demo
- node Version: 20.5.1 (also tested on 20.11.0 FROM node:20-slim)
- npm version: 10.2.5
- OS: MacOs 12.7.2
- Browser: Firefox 121.0.1