Skip to content

When net.fetch handles requests, if the response header contains Chinese content, it throws an error #46819

Open
@hanyefeng

Description

@hanyefeng

Preflight Checklist

Electron Version

35.2.1

What operating system(s) are you using?

macOS

Operating System Version

Sequoia 15.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

When using protocol.handle to intercept HTTPS requests, for requests that do not require processing, I use net.fetch to handle them. For download file requests, the Content-Disposition header in the response contains Chinese content (the file name), as shown in the image below.
Image
Upon reviewing the specification, I found that filename is compatible with older browser versions and can be set with Chinese characters. When filename* is present, the browser will ignore filename and directly recognize filename*, which contains the correctly encoded file name.

Actual Behavior

Image

Image

Currently, net.fetch directly checks every character of the response header content, and it throws an error in a very aggressive manner. This doesn’t fully comply with the specification.

Testcase Gist URL

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    👀 Unsorted Items

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close