I'm working on VSCode extension that uses WebView to show additional data. I works fine apart from the webview icon.
If nothing is specified the icon is:
I was reading the documentation and noticed that WebView allow iconPath option with the following format:
I've tried to add the icon using the following code:
const onDiskPath = vscode.Uri.file(
path.join(context.extensionPath, 'resources', 'my-icon.svg')
);
panel.iconPath = panel.webview.asWebviewUri(onDiskPath);
But I'm getting an error:
Refused to load the image 'vscode-resource://file///f:/dev/my-extension/resources/my-icon.svg' because it violates the following Content Security Policy directive: "img-src 'self' https: data: blob: vscode-remote-resource:".
In the webview html the following content policy is avaialble:
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; img-src vscode-resource: https:; script-src 'nonce-${nonce}';">
(i've tried messing with the content policies but nothing has changed. The same error is shown)
Is there a problem with the content policy or the way the icon path is generated? (or its something completely different :) )

