Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eadad9f

Browse files
committedJul 13, 2022
fix(workbench): use window.location without origin
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 eadad9f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎patches/base-path.diff

Lines changed: 9 additions & 0 deletions
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)
Please sign in to comment.