@@ -261,16 +261,32 @@ index 2c64061da7..c0ef8faedd 100644
261
261
// Do nothing. If we can't read the file we have no
262
262
// language pack config.
263
263
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
264
- index 45f6f17ce0..4d1a590a7c 100644
264
+ index 45f6f17ce0..102289c147 100644
265
265
--- a/src/vs/code/browser/workbench/workbench.ts
266
266
+++ b/src/vs/code/browser/workbench/workbench.ts
267
+ @@ -16,6 +16,7 @@ import product from 'vs/platform/product/common/product';
268
+ import { Schemas } from 'vs/base/common/network';
269
+ import { posix } from 'vs/base/common/path';
270
+ import { localize } from 'vs/nls';
271
+ + import { encodePath } from 'vs/server/node/util';
272
+
273
+ interface ICredential {
274
+ service: string;
275
+ @@ -237,7 +238,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
276
+ }
277
+
278
+ private createTargetUrl(workspace: IWorkspace, options?: { reuse?: boolean, payload?: object }): string | undefined {
279
+ -
280
+ // Empty
281
+ let targetHref: string | undefined = undefined;
282
+ if (!workspace) {
267
283
@@ -246,12 +246,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
268
284
269
285
// Folder
270
286
else if (isFolderToOpen(workspace)) {
271
287
- targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_FOLDER}=${encodeURIComponent(workspace.folderUri.toString())}`;
272
288
+ const target = workspace.folderUri.scheme === Schemas.vscodeRemote
273
- + ? encodeURIComponent (workspace.folderUri.path).replace(/%2F/g, "/" )
289
+ + ? encodePath (workspace.folderUri.path)
274
290
+ : encodeURIComponent(workspace.folderUri.toString());
275
291
+ targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_FOLDER}=${target}`;
276
292
}
@@ -279,7 +295,7 @@ index 45f6f17ce0..4d1a590a7c 100644
279
295
else if (isWorkspaceToOpen(workspace)) {
280
296
- targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_WORKSPACE}=${encodeURIComponent(workspace.workspaceUri.toString())}`;
281
297
+ const target = workspace.workspaceUri.scheme === Schemas.vscodeRemote
282
- + ? encodeURIComponent (workspace.workspaceUri.path).replace(/%2F/g, "/" )
298
+ + ? encodePath (workspace.workspaceUri.path)
283
299
+ : encodeURIComponent(workspace.workspaceUri.toString());
284
300
+ targetHref = `${document.location.origin}${document.location.pathname}?${WorkspaceProvider.QUERY_PARAM_WORKSPACE}=${target}`;
285
301
}
@@ -290,7 +306,7 @@ index 45f6f17ce0..4d1a590a7c 100644
290
306
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
291
307
292
308
+ // Strip the protocol from the authority if it exists.
293
- + const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, "");
309
+ + const normalizeAuthority = (authority? : string): string => authority && authority.replace(/^https?:\/\//, "");
294
310
+ if (config.remoteAuthority) {
295
311
+ (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority);
296
312
+ }
@@ -2346,10 +2362,10 @@ index 0000000000..3c74512192
2346
2362
+ }
2347
2363
diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
2348
2364
new file mode 100644
2349
- index 0000000000..d6dcfe1fe7
2365
+ index 0000000000..52311bf756
2350
2366
--- /dev/null
2351
2367
+++ b/src/vs/server/node/server.ts
2352
- @@ -0,0 +1,257 @@
2368
+ @@ -0,0 +1,269 @@
2353
2369
+ import * as net from 'net';
2354
2370
+ import * as path from 'path';
2355
2371
+ import { Emitter } from 'vs/base/common/event';
@@ -2429,10 +2445,22 @@ index 0000000000..d6dcfe1fe7
2429
2445
+ await this.servicesPromise;
2430
2446
+ const environment = this.services.get(IEnvironmentService) as IEnvironmentService;
2431
2447
+ const startPath = options.startPath;
2448
+ + const parseUrl = (url: string): URI => {
2449
+ + // This might be a fully-specified URL or just a path.
2450
+ + try {
2451
+ + return URI.parse(url, true);
2452
+ + } catch (error) {
2453
+ + return URI.from({
2454
+ + scheme: Schemas.vscodeRemote,
2455
+ + authority: options.remoteAuthority,
2456
+ + path: url,
2457
+ + });
2458
+ + }
2459
+ + };
2432
2460
+ return {
2433
2461
+ workbenchWebConfiguration: {
2434
- + workspaceUri: startPath && startPath.workspace ? URI.parse (startPath.url) : undefined,
2435
- + folderUri: startPath && !startPath.workspace ? URI.parse (startPath.url) : undefined,
2462
+ + workspaceUri: startPath && startPath.workspace ? parseUrl (startPath.url) : undefined,
2463
+ + folderUri: startPath && !startPath.workspace ? parseUrl (startPath.url) : undefined,
2436
2464
+ remoteAuthority: options.remoteAuthority,
2437
2465
+ logLevel: getLogLevel(environment),
2438
2466
+ },
@@ -2639,10 +2667,10 @@ index 0000000000..fc69441cf0
2639
2667
+ };
2640
2668
diff --git a/src/vs/server/node/util.ts b/src/vs/server/node/util.ts
2641
2669
new file mode 100644
2642
- index 0000000000..06b080044c
2670
+ index 0000000000..dd7fdf7b58
2643
2671
--- /dev/null
2644
2672
+++ b/src/vs/server/node/util.ts
2645
- @@ -0,0 +1,9 @@
2673
+ @@ -0,0 +1,17 @@
2646
2674
+ import { getPathFromAmdModule } from 'vs/base/common/amd';
2647
2675
+ import { URITransformer, IRawURITransformer } from 'vs/base/common/uriIpc';
2648
2676
+
@@ -2652,6 +2680,14 @@ index 0000000000..06b080044c
2652
2680
+ const rawURITransformer = <IRawURITransformer>rawURITransformerFactory(remoteAuthority);
2653
2681
+ return new URITransformer(rawURITransformer);
2654
2682
+ };
2683
+ +
2684
+ + /**
2685
+ + * Encode a path for opening via the folder or workspace query parameter. This
2686
+ + * preserves slashes so it can be edited by hand more easily.
2687
+ + */
2688
+ + export const encodePath = (path: string): string => {
2689
+ + return path.split("/").map((p) => encodeURIComponent(p)).join("/");
2690
+ + };
2655
2691
diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts
2656
2692
index e69aa80159..71a899d37b 100644
2657
2693
--- a/src/vs/workbench/api/browser/extensionHost.contribution.ts
0 commit comments