From 21495c8a916f2b99c4614edd469c3572452c13e2 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 17 Dec 2021 14:58:04 -0700 Subject: [PATCH] fix: add remoteAuthority for URIs --- src/vs/code/browser/workbench/workbench.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts index 35a23054900bf..289a100e3d492 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -440,12 +440,17 @@ class WindowIndicator implements IWindowIndicator { /** * If the value begins with a slash assume it is a file path and convert it to * use the vscode-remote scheme. + * + * We also add the remote authority in toRemote. It needs to be accurate + * otherwise other URIs won't match it, leading to issues such as this one: + * https://github.com/coder/code-server/issues/4630 * * @author coder */ + const remoteAuthority = location.host const toRemote = (value: string): string => { if (value.startsWith('/')) { - return 'vscode-remote://' + value; + return 'vscode-remote://' + remoteAuthority + value; } return value; }; @@ -564,7 +569,7 @@ class WindowIndicator implements IWindowIndicator { * determine this reliably on the backend. * @author coder */ - remoteAuthority: location.host, + remoteAuthority, /** * Override relative URLs in the product configuration against the window * location as necessary. Only paths that must be absolute need to be