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

Gutter icon: Refused to load resource #118623

Closed
usernamehw opened this issue Mar 10, 2021 · 6 comments
Closed

Gutter icon: Refused to load resource #118623

usernamehw opened this issue Mar 10, 2021 · 6 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@usernamehw
Copy link
Contributor

usernamehw commented Mar 10, 2021

In 1.54 custom gutter icon stopped working. I don't see anything in release notes that would indicate what kind of feature this is (Result of work on Sandbox?).

[error] file: Refused to load resource c:\add.svg from file: protocol (original URL: file:///C:/add.svg)
  1. Create a text editor decoration with gutterIconPath set it as a string to local file path "errorLens.errorGutterIconPath": "C:\\add.svg"
  2. It's not loaded

Icons in extension directory are loaded without problems. Only outside files refuse.

This was working from vscode version maybe <1.20 to >=1.53.

@bpasero
Copy link
Member

bpasero commented Mar 11, 2021

@usernamehw this is an extension providing that setting? As part of our sandbox effort we start to block resources that are outside these locations for security reasons:

  • installation dir
  • extensions dir
  • user data dir

It is rather unlikely we would relax this restriction going forward.

//cc @deepak1556

@bpasero bpasero added the info-needed Issue requires more information from poster label Mar 11, 2021
@usernamehw
Copy link
Contributor Author

usernamehw commented Mar 12, 2021

this is an extension providing that setting?

Yes. A minor feature.

It's just a breaking change that doesn't seem to be in the release notes. The only issues I was able to find with this description are the ones about webviews.

Right now the workaround is to copy those files using NodeJS copyFile() into extension directory. Is sandboxing endgame going to prevent me doing that?

@bpasero
Copy link
Member

bpasero commented Mar 12, 2021

@usernamehw yeah I actually forgot to document that. As an extension you will have full node.js API access even when sandbox is enabled, nothing changes for extensions.

@usernamehw
Copy link
Contributor Author

Ok. Closing then.

@alefragnani
Copy link

Hi @bpasero ,

What if the extension is updated? Wouldn't you lose the copied resources because the older release will be deleted after you restart VS Code? Or will VS Code leave these files there, because aren't from the original vsix file?

I guess in this case we should use context.globalStorageUri, which is "a directory in which the extension can store global state" .

Thank you

@bpasero
Copy link
Member

bpasero commented Mar 14, 2021

Yes, use context.globalStorageUri, it will be accessible within VSCode.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants