diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index 2ea764a81e11b..d7d5621eec4ad 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -1199,7 +1199,7 @@ export function asDomUri(uri: URI): URI { if (Schemas.vscodeRemote === uri.scheme) { // rewrite vscode-remote-uris to uris of the window location // so that they can be intercepted by the service worker - return _location.with({ path: '/vscode-resources/fetch', query: uri.toString() }); + return _location.with({ path: '/vscode-resources/fetch', query: JSON.stringify({ u: uri.toJSON(), i: 1 }) }); } return uri; } diff --git a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts index 85c162c2327a3..02182971b09f3 100644 --- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts +++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { URI } from 'vs/base/common/uri'; +import { URI, UriComponents } from 'vs/base/common/uri'; import { generateUuid } from 'vs/base/common/uuid'; import { getMediaMime } from 'vs/base/common/mime'; @@ -78,13 +78,13 @@ async function respondWithResource(event: FetchEvent, uri: URI): Promise(resolve => { const token = generateUuid(); - const resourceUri = URI.parse(uri.query); + const query: { u: UriComponents, i: number } = JSON.parse(uri.query); _pendingFetch.set(token, async (data: ArrayBuffer, isExtensionResource: boolean) => { const res = new Response(data, { status: 200, - headers: { 'Content-Type': getMediaMime(resourceUri.path) || 'text/plain' } + headers: { 'Content-Type': getMediaMime(query.u.path) || 'text/plain' } }); if (isExtensionResource) { @@ -97,7 +97,7 @@ async function respondWithResource(event: FetchEvent, uri: URI): Promise { - client.postMessage({ uri: resourceUri, token }); + client.postMessage({ uri: query.u, token }); }); }); }