未验证 提交 26584f20 编写于 作者: A Asher

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).
上级 a4c0fd1f
......@@ -248,7 +248,7 @@ index 2c64061da7..c0ef8faedd 100644
// Do nothing. If we can't read the file we have no
// language pack config.
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
index 45f6f17ce0..79fde0b92c 100644
index 45f6f17ce0..4d1a590a7c 100644
--- a/src/vs/code/browser/workbench/workbench.ts
+++ b/src/vs/code/browser/workbench/workbench.ts
@@ -246,12 +246,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
......@@ -272,7 +272,26 @@ index 45f6f17ce0..79fde0b92c 100644
}
// Append payload if any
@@ -302,35 +308,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
@@ -290,6 +296,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
+ // Strip the protocol from the authority if it exists.
+ const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, "");
+ if (config.remoteAuthority) {
+ (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority);
+ }
+ if (config.workspaceUri) {
+ config.workspaceUri.authority = normalizeAuthority(config.workspaceUri.authority);
+ }
+ if (config.folderUri) {
+ config.folderUri.authority = normalizeAuthority(config.folderUri.authority);
+ }
+
// Revive static extension locations
if (Array.isArray(config.staticExtensions)) {
config.staticExtensions.forEach(extension => {
@@ -302,35 +320,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
let workspace: IWorkspace;
let payload = Object.create(null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册