From 8d9fbe1b791f3fe34d1fc8c9fcef44f611d25bcb Mon Sep 17 00:00:00 2001 From: Deepak Bhagat Date: Tue, 7 Apr 2026 03:34:19 +0530 Subject: [PATCH] fix(api): encode URL query params to handle special characters in search and user lookups --- packages/api/src/EmbeddedChatApi.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/api/src/EmbeddedChatApi.ts b/packages/api/src/EmbeddedChatApi.ts index 72e25a046..41450b74c 100644 --- a/packages/api/src/EmbeddedChatApi.ts +++ b/packages/api/src/EmbeddedChatApi.ts @@ -1121,7 +1121,7 @@ export default class EmbeddedChatApi { try { const { userId, authToken } = (await this.auth.getCurrentUser()) || {}; const response = await fetch( - `${this.host}/api/v1/chat.search?roomId=${this.rid}&searchText=${text}`, + `${this.host}/api/v1/chat.search?roomId=${encodeURIComponent(this.rid)}&searchText=${encodeURIComponent(text)}`, { headers: { "Content-Type": "application/json", @@ -1233,7 +1233,7 @@ export default class EmbeddedChatApi { async getUserStatus(reqUserId: string) { const { userId, authToken } = (await this.auth.getCurrentUser()) || {}; const response = await fetch( - `${this.host}/api/v1/users.getStatus?userId=${reqUserId}`, + `${this.host}/api/v1/users.getStatus?userId=${encodeURIComponent(reqUserId)}`, { method: "GET", headers: { @@ -1250,7 +1250,7 @@ export default class EmbeddedChatApi { async userInfo(reqUserId: string) { const { userId, authToken } = (await this.auth.getCurrentUser()) || {}; const response = await fetch( - `${this.host}/api/v1/users.info?userId=${reqUserId}`, + `${this.host}/api/v1/users.info?userId=${encodeURIComponent(reqUserId)}`, { method: "GET", headers: { @@ -1267,7 +1267,7 @@ export default class EmbeddedChatApi { async userData(username: string) { const { userId, authToken } = (await this.auth.getCurrentUser()) || {}; const response = await fetch( - `${this.host}/api/v1/users.info?username=${username}`, + `${this.host}/api/v1/users.info?username=${encodeURIComponent(username)}`, { method: "GET", headers: {