MicrosoftEdge / MicrosoftEdge/WebView2Feedback

WebView2 trims relative paths from href definitions

Open
#2,719 3 comments 0 reactions 1 assignee View on GitHub

@LiangTheDev is already working on this.

Since Aug 29, 2022.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description
href paths which contains relative paths are no working correctly. If href contains definition like "../../SomeFolder/somefile.txt" when user will click on link system is trying to open path over "http://[browsing-file-host](http://browsing-file-host/SomeFolder/somefile.txt". Relative path portion of path is removed. See attached image.

WebView2 is setup with fallowing call
string baseHref = Path.GetDirectoryName(_file).Replace("\", "/");
_browser.CoreWebView2.SetVirtualHostNameToFolderMapping(_mappedBrowsingFileVirtualHostName, baseHref, CoreWebView2HostResourceAccessKind.Allow);

where baseHref is pointing to correct root for relative paths,

Version
SDK:
Runtime:
Framework:
OS:

Repro Steps
WebView2RelativePathNavigation

Screenshots

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.