Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,18 @@ export async function activate(context: ExtensionContext) {
}
const auth = serverSpec.auth ?? new BasicAuthorization(serverSpec.username, serverSpec.password);
if ([undefined, ""].includes(auth?.username)) {
const partialKey = `${serverSpec.host}:${serverSpec.port}${serverSpec.pathPrefix}`.toLowerCase();
const partialKey =
Comment thread
isc-klu marked this conversation as resolved.
Outdated
`${serverSpec.host}:${serverSpec.port}${serverSpec.pathPrefix}/${serverSpec.namespace}`.toLowerCase();
for (const key of resolvedServerSpecs.keys()) {
// The username isn't known yet, so see if we have a connection to this server that is already known
// The username isn't known yet, so see if we have a connection to this server+namespace that is already known
if (key.toLowerCase().slice(key.indexOf("@") + 1) == partialKey) {
return resolvedServerSpecs.get(key);
}
}
} else {
// Return resolved spec if we have one that matches exactly
const key = `${auth.username}@${serverSpec.host}:${serverSpec.port}${serverSpec.pathPrefix}`.toLowerCase();
// Return resolved spec if we have one that matches exactly (including namespace)
const key =
`${auth.username}@${serverSpec.host}:${serverSpec.port}${serverSpec.pathPrefix}/${serverSpec.namespace}`.toLowerCase();
if (resolvedServerSpecs.has(key)) return resolvedServerSpecs.get(key);
}
if (
Expand Down Expand Up @@ -241,7 +243,8 @@ export async function activate(context: ExtensionContext) {
username: auth.username,
credentials: auth.credentials,
};
const serverKey = `${server.username}@${server.host}:${server.port}${server.pathPrefix}`.toLowerCase();
const serverKey =
`${server.username}@${server.host}:${server.port}${server.pathPrefix}/${server.namespace}`.toLowerCase();
if (!resolvedServerSpecs.has(serverKey)) resolvedServerSpecs.set(serverKey, server);
return server;
} catch {
Expand Down