Skip to content

Commit 5c16399

Browse files
committed
Fix accessing versioned resource using file service
Fixes #986.
1 parent 0141ded commit 5c16399

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/channel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
164164

165165
private transform(resource: UriComponents): URI {
166166
// Used for walkthrough content.
167-
if (resource.path.indexOf("/static") === 0) {
168-
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static/, ""));
167+
if (/^\/static[^/]*\//.test(resource.path)) {
168+
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, "/"));
169169
// Used by the webview service worker to load resources.
170170
} else if (resource.path === "/vscode-resource" && resource.query) {
171171
try {

src/server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export abstract class Server {
279279
// without adding query parameters which have their own issues.
280280
// REVIEW: Discuss whether this is the best option; this is sort of a quick
281281
// hack almost to get caching in the meantime but it does work pretty well.
282-
if (/static-.+/.test(base)) {
282+
if (/^\/static-.+/.test(base)) {
283283
base = "/static";
284284
}
285285

0 commit comments

Comments
 (0)