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

[Problem/Bug]: attachment:// scheme not working anymore #5086

Open
Hyrius opened this issue Feb 4, 2025 · 9 comments
Open

[Problem/Bug]: attachment:// scheme not working anymore #5086

Hyrius opened this issue Feb 4, 2025 · 9 comments
Assignees
Labels
bug Something isn't working regression Something used to work but doesn't anymore tracked We are tracking this work internally.

Comments

@Hyrius
Copy link

Hyrius commented Feb 4, 2025

What happened?

I have links referencing attachment://file.ext that I handled programmatically, but it just stopped working and now I'm getting the Uri as about:blank#blocked in my events. Did anything change?

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

133.0.3065.39

SDK Version

No response

Framework

Winforms

Operating System

Windows 11

OS Version

No response

Repro steps

It's a manually loaded HTML page containing links like <a href="attachment://file.jpg">attachment 1</a> and I used to be able to deal with them programmatically in the NavigationStarting event.
Now, e.Uri is about:blank#blocked.

It seems to only occur in links added using JavaScript, a sample project was added in the comments.

Repros in Edge Browser

No response

Regression

Regression in newer Runtime

Last working version (if regression)

132.0.2957.140

@Hyrius Hyrius added the bug Something isn't working label Feb 4, 2025
@github-actions github-actions bot added the regression Something used to work but doesn't anymore label Feb 4, 2025
@Hyrius
Copy link
Author

Hyrius commented Feb 4, 2025

I tried it in a new project and it worked as expected. I will keep trying to understand what's going on.

@Hyrius Hyrius closed this as completed Feb 4, 2025
@Hyrius
Copy link
Author

Hyrius commented Feb 5, 2025

I did some more testing, and the issue didn’t occur because I was testing on another machine with Runtime 132.0.2957.140.
However, the exact same code doesn’t work (it navigates to about:blank#blocked) in Runtime 133.0.3065.39.
The SDK version appears to be irrelevant.
The issue is probably related to links added via JavaScript… I think?

WebView2CustomSchemeTest.zip

@Hyrius Hyrius reopened this Feb 5, 2025
@ParadoxZero
Copy link

@Hyrius please share a snippet of how you are using the API.

@ParadoxZero ParadoxZero self-assigned this Feb 7, 2025
@Hyrius
Copy link
Author

Hyrius commented Feb 7, 2025

@Hyrius please share a snippet of how you are using the API.

Hey! I attached a sample project in my last comment. Clicking the link in the WebView2 works if the Runtime is 132, but is blocked if it is 133.

@ParadoxZero
Copy link

Thanks @Hyrius, somehow my brain skipped over it. Marking the regression as tracked.

@ParadoxZero ParadoxZero added the tracked We are tracking this work internally. label Feb 7, 2025
@prija-microsoft prija-microsoft self-assigned this Feb 7, 2025
@ParadoxZero ParadoxZero removed their assignment Feb 7, 2025
@prija-microsoft
Copy link

prija-microsoft commented Feb 7, 2025

This is due to "|" not a valid character in URL path. which makes the URL invalid. This is in line with what is true with edge/chrome behavior.
Can you try using a valid URL character as per https://www.rfc-editor.org/rfc/rfc3986.

Also I do see you are handling navigationStarting event and cancelling the request. You can also look at implementing custom scheme and listening to WebResourceRequested event for that filter.

@Hyrius
Copy link
Author

Hyrius commented Feb 7, 2025

I'm canceling in this example to prevent navigation to about:blank#blocked, which would make the link disappear.
Regarding the custom scheme, I hadn’t set it up before (in 132), but it still worked. I tried setting it up in version 133 to see if it made a difference, but nothing changed. I'll try again without the "|" character.

It worked perfectly in Runtime version 133 with valid links, and I didn’t need to implement a custom scheme for my use case.
Thanks for the clarification and for helping me understand what I did wrong.

@prija-microsoft
Copy link

@Hyrius I tried with runtime 132 as well, and it is failing with "|". Can you please share etw traces if it is working for older runtime.

@Hyrius
Copy link
Author

Hyrius commented Feb 10, 2025

@prija-microsoft Okay, so I did what you asked, but it seems like it failed...

Image

I think the ETL file wasn't created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something used to work but doesn't anymore tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

4 participants