Skip to content

Commit f79b38d

Browse files
authored
fix(workbench): use window.location without origin (#5332)
When using `window.location.origin` to create a new URL for loading web packages, it constructs a URL that is not relative, leading to the terminal breaking when code-server is served not via the root (i.e. /ide instead of /).
1 parent 9ad0d9e commit f79b38d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

patches/base-path.diff

+9
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
8686
<link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.main.css">
8787

8888
</head>
89+
@@ -38,7 +38,7 @@
90+
<script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/loader.js"></script>
91+
<script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/webPackagePaths.js"></script>
92+
<script>
93+
- const baseUrl = new URL('{{WORKBENCH_WEB_BASE_URL}}', window.location.origin).toString();
94+
+ const baseUrl = new URL('{{WORKBENCH_WEB_BASE_URL}}', window.location).toString();
95+
Object.keys(self.webPackagePaths).map(function (key, index) {
96+
self.webPackagePaths[key] = `${baseUrl}/node_modules/${key}/${self.webPackagePaths[key]}`;
97+
});
8998
Index: code-server/lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts
9099
===================================================================
91100
--- code-server.orig/lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts

0 commit comments

Comments
 (0)