@devries-cameron20 / composio Mirror · read-only / commits / cc02cfec5
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 23:30 UTC

fix(cli): encode path segments in dashboard fallback URL

The `handleNoManagedAuth` fallback in `composio link` constructs a dashboard URL to open in the browser, but the org name and toolkit slug were interpolated raw into the path. When the org name contains special characters (spaces, `@`, etc.), the unencoded URL passed to the `open` library gets mangled — the `?open=true` query parameter is absorbed into the path segment and percent-encoded as `%3Fopen%3Dtrue`. This causes the dashboard to interpret `twitter%3Fopen%3Dtrue` as the toolkit slug, which then hits the backend as `GET /api/v3/toolkits/twitter%3Fopen%3Dtrue` → 404. Fix: `encodeURIComponent()` both the org name and toolkit slug path segments, matching how the dashboard's own `getUrl()` builds paths. Sentry: https://composio-ly.sentry.io/issues/7412290676/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Sarah Simionescu committed Apr 15, 2026 at 14:04 UTC cc02cfec5f78c32f4af72d3b8fb1f54be7b5dbba
1 file changed +6 -3
ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.link.cmd.ts
+6 -3
@@ -184,7 +184,7 @@ const handleNoManagedAuth = (ui: TerminalUI, toolkitSlug: string) =>
184 const webURL = userContext.data.webURL.replace(/\/+$/, '');
185 const apiKey = Option.getOrUndefined(userContext.data.apiKey);
186
187 - let orgSlug = '~';
187 + let orgName = '~';
188 if (apiKey) {
189 const sessionInfo = yield* getSessionInfoByUserApiKey({
190 baseURL: userContext.data.baseURL,
@@ -192,11 +192,14 @@ const handleNoManagedAuth = (ui: TerminalUI, toolkitSlug: string) =>
192 }).pipe(Effect.catchAll(() => Effect.succeed(null)));
193
194 if (sessionInfo?.project.org.name) {
195 - orgSlug = sessionInfo.project.org.name;
195 + orgName = sessionInfo.project.org.name;
196 }
197 }
198
199 - const dashboardUrl = `${webURL}/${orgSlug}/~/connect/apps/${toolkitSlug}?open=true`;
199 + // Encode path segments so special characters in org names (spaces, @, etc.)
200 + // don't corrupt the URL structure — without this, `?open=true` can get
201 + // baked into the path as `%3Fopen%3Dtrue`, causing 404s on the dashboard.
202 + const dashboardUrl = `${webURL}/${encodeURIComponent(orgName)}/~/connect/apps/${encodeURIComponent(toolkitSlug)}?open=true`;
203
204 yield* ui.log.warn(
205 `Composio does not manage auth for "${toolkitSlug}" — opening the dashboard to connect manually.`