Handle webview service worker resource requests

This commit is contained in:
Asher 2019-08-15 14:30:41 -05:00
parent 07ec4ca63e
commit a48c2fb119
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -166,7 +166,15 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
// HACK: for now assume /out is relative to the build (used for the // HACK: for now assume /out is relative to the build (used for the
// walkthrough content). // walkthrough content).
if (resource.path.indexOf("/out") === 0) { if (resource.path.indexOf("/out") === 0) {
resource.path = this.environmentService.appRoot + resource.path; return URI.file(this.environmentService.appRoot + resource.path);
// This is used by the webview service worker to load resources.
} else if (resource.path === "/vscode-resource" && resource.query) {
try {
const query = JSON.parse(resource.query);
if (query.requestResourcePath) {
return URI.file(query.requestResourcePath);
}
} catch (error) { /* Carry on. */ }
} }
return URI.from(resource); return URI.from(resource);
} }