Skip to content

Commit 2b4f50f

Browse files
committed
💄
1 parent 1ccdb1f commit 2b4f50f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/local-ssh/ipc/extensionServiceServer.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,24 @@ class ExtensionServiceImpl implements ExtensionServiceImplementation {
122122
});
123123
}
124124

125-
const ownerToken = await this.sessionService.getAPI().getOwnerToken(actualWorkspaceId, _context.signal);
126-
127125
instanceId = rawWorkspace.status!.instance!.instanceId;
128126

129-
const workspaceUrl = new URL(wsData.workspaceUrl);
130-
const workspaceHost = workspaceUrl.host.substring(workspaceUrl.host.indexOf('.') + 1);
131-
let actualWorkspaceUrl = wsData.workspaceUrl;
132-
if (workspaceId !== actualWorkspaceId) {
133-
// Public api doesn't take into account "debug" workspaces, readd 'debug-' prefix
134-
actualWorkspaceUrl = actualWorkspaceUrl.replace(actualWorkspaceId, workspaceId);
135-
}
127+
let ownerToken = '';
128+
let workspaceHost = '';
129+
let sshkey = '';
130+
if (wsData.phase === 'running') {
131+
ownerToken = await this.sessionService.getAPI().getOwnerToken(actualWorkspaceId, _context.signal);
136132

137-
const sshkey = wsData.phase === 'running' ? (await this.getWorkspaceSSHKey(ownerToken, actualWorkspaceUrl, _context.signal)) : '';
133+
const workspaceUrl = new URL(wsData.workspaceUrl);
134+
workspaceHost = workspaceUrl.host.substring(workspaceUrl.host.indexOf('.') + 1);
135+
let actualWorkspaceUrl = wsData.workspaceUrl;
136+
if (workspaceId !== actualWorkspaceId) {
137+
// Public api doesn't take into account "debug" workspaces, readd 'debug-' prefix
138+
actualWorkspaceUrl = actualWorkspaceUrl.replace(actualWorkspaceId, workspaceId);
139+
}
140+
141+
sshkey = await this.getWorkspaceSSHKey(ownerToken, actualWorkspaceUrl, _context.signal);
142+
}
138143

139144
return {
140145
gitpodHost,

0 commit comments

Comments
 (0)