From 5c163998100e63da7a1dd0fa6e992a0985a65f4d Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 16 Sep 2019 10:59:28 -0500 Subject: [PATCH] Fix accessing versioned resource using file service Fixes #986. --- src/channel.ts | 4 ++-- src/server.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/channel.ts b/src/channel.ts index 9ce9e008..99fcb384 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -164,8 +164,8 @@ export class FileProviderChannel implements IServerChannel, IDisposable { private transform(resource: UriComponents): URI { // Used for walkthrough content. - if (resource.path.indexOf("/static") === 0) { - return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static/, "")); + if (/^\/static[^/]*\//.test(resource.path)) { + return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, "/")); // Used by the webview service worker to load resources. } else if (resource.path === "/vscode-resource" && resource.query) { try { diff --git a/src/server.ts b/src/server.ts index 5cb8770c..1fd57b9f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -279,7 +279,7 @@ export abstract class Server { // without adding query parameters which have their own issues. // REVIEW: Discuss whether this is the best option; this is sort of a quick // hack almost to get caching in the meantime but it does work pretty well. - if (/static-.+/.test(base)) { + if (/^\/static-.+/.test(base)) { base = "/static"; } -- GitLab