[Bug]: protocol.handle fails when filename contains '#' #42102
Labels
30-x-y
component/protocol
documentation 📓
has-repro-gist
Issue can be reproduced with code at https://gist.github.com/
Preflight Checklist
Electron Version
30.0.2
What operating system are you using?
Windows
Operating System Version
Windows 10 version 22H2
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
The image should display as normal.
Actual Behavior
When you're handling a file:// protocol request, it's being treated like a regular URL. However, the file:// protocol is different from HTTP or HTTPS URLs in how it handles characters like #. In a file:// URL, the # character is typically part of the file or directory name and is not treated as a fragment identifier like in HTTP URLs.
Testcase Gist URL
https://gist.github.com/KBriscoe/550df36cd29a4d27a7672f1404a9e990
Additional Information
If using the gist, the filepaths need to be updated in the renderer.js to actual images. The issue is when the image contains '#' in my case and I looked through the protocol.handle and saw it was treating it like a web request I believe where # usually means to truncate off the rest of the request. So it ends up trying to get an incorrect path item.
The text was updated successfully, but these errors were encountered: