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

asWebviewUri: UriError - the path cannot begin with two slash characters #1643

Closed
benc-uk opened this issue Oct 10, 2019 · 3 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) remote Issues in the code server support

Comments

@benc-uk
Copy link

benc-uk commented Oct 10, 2019

  • VSCode Version: 1.39
  • Local OS Version: Windows 10 Insiders 18995
  • Remote OS Version: Ubuntu 18.04
  • Remote Extension/Connection Type: WSL and SSH

Steps to Reproduce:

  1. Use v0.3.1 of my extension https://marketplace.visualstudio.com/items?itemName=bencoleman.armview in a WSL or SSH VS Code session
  2. None of the resources in the webview are loaded, the extension no longer works.
  3. I see error Unable to read file (Error: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//"))

I'm using the webview API
panel.webview.asWebviewUri to form the URLs of the components my WebView needs to load, e.g.

panel.webview.asWebviewUri(vscode.Uri.file(path.join(extensionPath, 'assets', 'css', 'main.css')));

I've been developing this extension for several weeks and work exclusively in WSL remote mode. I've never once had an issue until I updated to version 0.39.9 of the WSL extension (with VS Code 1.39).
Problem does NOT happen when working in local mode

Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: No

(Note. I've put a quick fix in the latest version v0.3.2 of my extension, but it's a clumsy hack to load all resources from remote external URL, which isn't a viable solution long term)

@benc-uk
Copy link
Author

benc-uk commented Oct 10, 2019

I can't determine if this is a regression caused by the WSL extension or VS Code itself
I tried running 1.38 of VS Code but that forced me to run an older version of the WSL extension also, making it impossible to pinpoint the cause

I got no problems on 1.38 of VS Code BTW

@benc-uk benc-uk changed the title Extension now reports UriError worked before 0.39.9 UriError - the path cannot begin with two slash characters Oct 11, 2019
@benc-uk
Copy link
Author

benc-uk commented Oct 11, 2019

Issue also happens in SSH, not just WSL

I've verified this affects other extensions using a webView and loading resources from the extension folder i.e. using asWebviewUri (i.e. vscode-resource URIs). For example the webview example in the vscode-extension-samples repo is now broken, when I try it under WSL and SSH

For example microsoft/vscode-extension-samples#219

Which provides a simple way to reproduce this issue. Note the cat GIF loads OK, as that's an external HTTP URL, but the JS file referenced from the extension (media directory) doesn't load due to the above error, so the line counter never goes up

@benc-uk benc-uk changed the title UriError - the path cannot begin with two slash characters asWebviewUri: UriError - the path cannot begin with two slash characters Oct 11, 2019
@egamma egamma added the remote Issues in the code server support label Oct 11, 2019
@mjbvz
Copy link

mjbvz commented Oct 14, 2019

Duplicate of microsoft/vscode#82336

@mjbvz mjbvz marked this as a duplicate of microsoft/vscode#82336 Oct 14, 2019
@mjbvz mjbvz closed this as completed Oct 14, 2019
@mjbvz mjbvz added the *duplicate Issue identified as a duplicate of another issue(s) label Oct 14, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) remote Issues in the code server support
Projects
None yet
Development

No branches or pull requests

3 participants