From dc967cffbecdf573aa48777ca7a245a6e633356c Mon Sep 17 00:00:00 2001 From: Rajiv Sahal Date: Wed, 30 Jul 2025 17:00:54 +0200 Subject: [PATCH] fix: redir parameter for connect atoms (#22815) * encode redirect url to make sure it has all parameters * add changesets --- .changeset/short-foxes-crash.md | 6 ++++++ packages/platform/atoms/hooks/connect/useConnect.ts | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/short-foxes-crash.md diff --git a/.changeset/short-foxes-crash.md b/.changeset/short-foxes-crash.md new file mode 100644 index 0000000000..a7b452fe8f --- /dev/null +++ b/.changeset/short-foxes-crash.md @@ -0,0 +1,6 @@ +--- +"@calcom/atoms": patch +--- + +This change fixes an issue in the CalendarSettings atom where the redirect urls were getting only one search param + diff --git a/packages/platform/atoms/hooks/connect/useConnect.ts b/packages/platform/atoms/hooks/connect/useConnect.ts index fe261c2bf4..bff70c92bd 100644 --- a/packages/platform/atoms/hooks/connect/useConnect.ts +++ b/packages/platform/atoms/hooks/connect/useConnect.ts @@ -18,6 +18,8 @@ export const useGetRedirectUrl = ( redir?: string, isDryRun?: boolean ) => { + const redirectUrl = !!redir ? encodeURIComponent(redir) : ""; + const authUrl = useQuery({ queryKey: getQueryKey(calendar), staleTime: Infinity, @@ -25,7 +27,7 @@ export const useGetRedirectUrl = ( queryFn: () => { return http ?.get>( - `/calendars/${calendar}/connect?redir=${redir ?? ""}&isDryRun=${isDryRun ?? ""}` + `/calendars/${calendar}/connect?redir=${redirectUrl}&isDryRun=${isDryRun ?? ""}` ) .then(({ data: responseBody }) => { if (responseBody.status === SUCCESS_STATUS) {