[Bug]: Download filename will be cut up to the first comma #31662
Closed
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 feature request that matches the one I want to file, without success.
Electron Version
15.3.0
What operating system are you using?
Windows
Operating System Version
Windows 11 21H2 (22000.282)
What arch are you using?
x64
Last Known Working Electron version
latest 11, aka 11.5.0
Expected Behavior
Downloading a file with a comma in name should return full filename.
Actual Behavior
When the request is filtered with onHeadersReceived
, the filename is cut up to the first comma.
Testcase Gist URL
No response
Additional Information
The issue was first reported in #29346 but was closed because it was unable to reproduce it.
http.txt
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Disposition: attachment; filename="foo,bar.txt"
Content-Length: 3
foo
Serve via ncat on port 1337
ncat -l 1337 < http.txt
Minimal Electron code:
const {app, BrowserWindow} = require('electron')
function createWindow () {
app.on('session-created', session => {
session.webRequest.onHeadersReceived((details, callback) => {
callback({ responseHeaders: details.responseHeaders });
});
});
const mainWindow = new BrowserWindow({
width: 800,
height: 600
})
mainWindow.loadURL('http://localhost:1337/')
}
app.whenReady().then(createWindow);