Skip to content

Commit 26584f2

Browse files
committed
Strip protocol from remote authority
In Google cloud shell the host header is 127.0.0.1:8080 instead of the actual URL. This is what we write out to the HTML so VS Code can pick it up. However cloud shell rewrites this string when found in the HTML before serving it so it becomes https://8080-[...].appspot.com, resulting in an extra unexpected https:// in the URI (vscode-remote://https://8080[...]). The resulting malformed URI causes the extension host to exit. - Fixes #1471 - Fixes #1468 - Fixes #1440 (most likely).
1 parent a4c0fd1 commit 26584f2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

ci/vscode.patch

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ index 2c64061da7..c0ef8faedd 100644
248248
// Do nothing. If we can't read the file we have no
249249
// language pack config.
250250
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
251-
index 45f6f17ce0..79fde0b92c 100644
251+
index 45f6f17ce0..4d1a590a7c 100644
252252
--- a/src/vs/code/browser/workbench/workbench.ts
253253
+++ b/src/vs/code/browser/workbench/workbench.ts
254254
@@ -246,12 +246,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
@@ -272,7 +272,26 @@ index 45f6f17ce0..79fde0b92c 100644
272272
}
273273

274274
// Append payload if any
275-
@@ -302,35 +308,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
275+
@@ -290,6 +296,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
276+
277+
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
278+
279+
+ // Strip the protocol from the authority if it exists.
280+
+ const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, "");
281+
+ if (config.remoteAuthority) {
282+
+ (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority);
283+
+ }
284+
+ if (config.workspaceUri) {
285+
+ config.workspaceUri.authority = normalizeAuthority(config.workspaceUri.authority);
286+
+ }
287+
+ if (config.folderUri) {
288+
+ config.folderUri.authority = normalizeAuthority(config.folderUri.authority);
289+
+ }
290+
+
291+
// Revive static extension locations
292+
if (Array.isArray(config.staticExtensions)) {
293+
config.staticExtensions.forEach(extension => {
294+
@@ -302,35 +320,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
276295
let workspace: IWorkspace;
277296
let payload = Object.create(null);
278297

0 commit comments

Comments
 (0)