Skip to content

Commit 0e2dc9d

Browse files
authored
fix: add remoteAuthority for URIs (#31)
1 parent 48507d9 commit 0e2dc9d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/vs/code/browser/workbench/workbench.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,17 @@ class WindowIndicator implements IWindowIndicator {
440440
/**
441441
* If the value begins with a slash assume it is a file path and convert it to
442442
* use the vscode-remote scheme.
443+
*
444+
* We also add the remote authority in toRemote. It needs to be accurate
445+
* otherwise other URIs won't match it, leading to issues such as this one:
446+
* https://github.com/coder/code-server/issues/4630
443447
*
444448
* @author coder
445449
*/
450+
const remoteAuthority = location.host
446451
const toRemote = (value: string): string => {
447452
if (value.startsWith('/')) {
448-
return 'vscode-remote://' + value;
453+
return 'vscode-remote://' + remoteAuthority + value;
449454
}
450455
return value;
451456
};
@@ -564,7 +569,7 @@ class WindowIndicator implements IWindowIndicator {
564569
* determine this reliably on the backend.
565570
* @author coder
566571
*/
567-
remoteAuthority: location.host,
572+
remoteAuthority,
568573
/**
569574
* Override relative URLs in the product configuration against the window
570575
* location as necessary. Only paths that must be absolute need to be

0 commit comments

Comments
 (0)