electron icon indicating copy to clipboard operation
electron copied to clipboard

[Bug]: Inconclusive Parsing of Content-Disposition Header

Open gdavidkov opened this issue 1 year ago • 5 comments

Preflight Checklist

Electron Version

30.0.0

What operating system are you using?

Windows

Operating System Version

Microsoft Windows [Version 10.0.19045.4291]

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

The "content-disposition" header shouldn't be modified and work as in Chromium. Please, take a look at the screenshots I've attached. The problem is in the function HttpResponseHeadersToV8 - https://github.com/electron/electron/blob/main/shell/browser/api/electron_api_web_request.cc#L93C22-L93C45

Actual Behavior

1a 2a

Testcase Gist URL

https://gist.github.com/gdavidkov/08a8edae420a5b30e9f855f0ebb75a63

Additional Information

Ref: https://github.com/electron/electron/pull/25961 PR: https://github.com/electron/electron/pull/31669

gdavidkov avatar Apr 23 '24 06:04 gdavidkov

When I try to add the missing information to the header, I encounter the following problem: image image

gdavidkov avatar Apr 23 '24 13:04 gdavidkov

If the header is in not the correct format, the filename is empty. I think we should return the original header like in the Chromium. 3a 4a 5

gdavidkov avatar Apr 24 '24 05:04 gdavidkov

This bug is happening due to a change that was made in this pull request. Unfortunately, if the onHeadersReceived is used and client code needs to modify headers, the original value of the constent-disposition header is lost. Moreover the new value incorrectly includes a space before the word attachment and it drops the value of filename*, which is what should be used to avoid issues with filename encoding on the client side.

The PR should be undone. Reference to similar comment

alfein avatar May 04 '24 20:05 alfein

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

Bump

alfein avatar Aug 05 '24 02:08 alfein