Skip to content

The agent that grows with you

fix(desktop): compare the moved agent's legacy URL with the shared gateway normaliser

kshitijk4poor8ece9242a64a
diff --git a/apps/desktop/src/app/settings/cloud-team-change.ts b/apps/desktop/src/app/settings/cloud-team-change.ts
index 0d3cd3c38ae..575150f4d8b 100644
--- a/apps/desktop/src/app/settings/cloud-team-change.ts
+++ b/apps/desktop/src/app/settings/cloud-team-change.ts
@@ -1,5 +1,7 @@
import type { DesktopRegistryConnection } from '@/global'
+import { normalizeGatewayUrl } from './connections-registry'
+
// `org` values are the refs NAS echoes (`slug ?? id`) and are compared as
// opaque strings. If a team gains or changes its slug, a connection saved under
// the old ref reads as moved once: the reconnect below re-authenticates and
@@ -48,7 +50,7 @@ export async function reconnectMovedCloudAgent(
return false
}
- if (config.mode === 'cloud' && config.remoteUrl.replace(/\/+$/, '') === url.replace(/\/+$/, '')) {
+ if (config.mode === 'cloud' && normalizeGatewayUrl(config.remoteUrl) === normalizeGatewayUrl(url)) {
await desktop.saveConnectionConfig({ mode: 'cloud', remoteUrl: config.remoteUrl, cloudOrg: org })
}