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

[Bug]: Download filename will be cut up to the first comma #31662

Closed
3 tasks done
alefoll opened this issue Nov 2, 2021 · 1 comment · Fixed by #31669
Closed
3 tasks done

[Bug]: Download filename will be cut up to the first comma #31662

alefoll opened this issue Nov 2, 2021 · 1 comment · Fixed by #31669
Assignees
Labels
15-x-y bug 🪲 platform/all status/confirmed A maintainer reproduced the bug or agreed with the feature

Comments

@alefoll
Copy link

alefoll commented Nov 2, 2021

Preflight Checklist

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);
@codebytere codebytere self-assigned this Nov 2, 2021
@codebytere codebytere added 15-x-y platform/all status/confirmed A maintainer reproduced the bug or agreed with the feature labels Nov 2, 2021
@codebytere
Copy link
Member

codebytere commented Nov 2, 2021

hey @alefoll i had a few minutes to look into this today - figured it out and popped up a PR: #31669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
15-x-y bug 🪲 platform/all status/confirmed A maintainer reproduced the bug or agreed with the feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants