[Bug]: Non-standard behavior: Electron alter the response header Content-Disposition #34896
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
15.3.1
What operating system are you using?
Windows
Operating System Version
Windows 11 with latest updates
What arch are you using?
x64
Last Known Working Electron version
15.3.0
Expected Behavior
If web server response a blob with file name specified in Content-Disposition
with encoding, for example:
server response header include:
content-disposition: "attachment; filename*=UTF-8''filename.xlsx"
Electron should pass server response header Content-Disposition
as it is in XMLHttpRequest so app JavaScript can handle it correctly, should not change it's value.
Actual Behavior
Due to the change in the PR: #31669
response header value content-disposition
will be replaced if the value contains encoding info.
content-disposition: "attachment; filename*=UTF-8''filename.txt"
will be changed to:
content-disposition: "attachment; filename=\"filename.txt\""
If I inspect web request with dev tool, I can see the network panel shows the response header with original value, but in the JS XMLHttpRequest handler, I can only get the altered value instead, this should not happen as it is not expected when we need to handle the file name in the header with JS code.
Testcase Gist URL
No response
Additional Information
The commit:
24b02d6
The PR:
#31669
Some doc online:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition