From a69f8fc378bb477df5b0cf1f5e59448ffc6c5316 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 10 Aug 2021 10:46:58 -0700 Subject: [PATCH] Revert "fix(lib/vscode): patch authority in asWebviewUri" This reverts commit 99503fb5463266805dd965dc20255a22f13862f2. After chatting with @code-asher, we realize we miscommunicated. We need this symlink in the standalone releases of code-server. Instead, we need to only remove the symlink in the npm package so we need to take a different approach. --- lib/vscode/src/vs/workbench/api/common/shared/webview.ts | 5 +---- .../workbench/contrib/webview/browser/pre/service-worker.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/vscode/src/vs/workbench/api/common/shared/webview.ts b/lib/vscode/src/vs/workbench/api/common/shared/webview.ts index c0449b6f108b..9c78a6bf9f1e 100644 --- a/lib/vscode/src/vs/workbench/api/common/shared/webview.ts +++ b/lib/vscode/src/vs/workbench/api/common/shared/webview.ts @@ -55,12 +55,9 @@ export function asWebviewUri( }); } - // NOTE@coder: Add the port separately because if the port is in the domain the - // URL will be invalid and the browser will not request it. - const authorityUrl = new URL(`${resource.scheme}://${resource.authority}`); return URI.from({ scheme: Schemas.https, - authority: `${resource.scheme}+${authorityUrl.hostname}.${webviewRootResourceAuthority}${authorityUrl.port ? (':' + authorityUrl.port) : ''}`, + authority: `${resource.scheme}+${resource.authority}.${webviewRootResourceAuthority}`, path: resource.path, fragment: resource.fragment, query: resource.query, diff --git a/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js b/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js index 3a66e7e62c22..8ff9e914ebad 100644 --- a/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js +++ b/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js @@ -256,7 +256,7 @@ async function processResourceRequest(event, requestUrl) { const firstHostSegment = requestUrl.hostname.slice(0, requestUrl.hostname.length - (resourceBaseAuthority.length + 1)); const scheme = firstHostSegment.split('+', 1)[0]; - const authority = firstHostSegment.slice(scheme.length + 1) + requestUrl.port ? (':' + requestUrl.port) : ''; // may be empty + const authority = firstHostSegment.slice(scheme.length + 1); // may be empty for (const parentClient of parentClients) { parentClient.postMessage({