From a48c2fb119375efba1ab18160b2ea680d30bd4cc Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 15 Aug 2019 14:30:41 -0500 Subject: [PATCH] Handle webview service worker resource requests --- src/channel.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/channel.ts b/src/channel.ts index ee407a752..bf054cfa9 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -166,7 +166,15 @@ export class FileProviderChannel implements IServerChannel, IDisposable { // HACK: for now assume /out is relative to the build (used for the // walkthrough content). 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); }