Skip to content

Commit

Permalink
Encode and decode the query parameter before sending it to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Sep 5, 2024
1 parent f94d243 commit 3356c4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/client/app/PlayGroundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const PlayGroundPage = ({ user }: { user: User }) => {
useEffect(() => {
if (formSubmitMsg && currentChatDetails) {
if (!currentChatDetails.userRespondedWithNextAction) {
setTriggerChatFormSubmitMsg(formSubmitMsg);
const decodedMessage = decodeURIComponent(formSubmitMsg);
setTriggerChatFormSubmitMsg(decodedMessage);
}
removeQueryParameters();
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/client/components/SelectTeamToChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const SelectTeamToChat = ({ userTeams }: any) => {
};
const chat: Chat = await createNewChat(props);
isRedirecting.current = true;
history.push(`/playground/${chat.uuid}?initiateChatMsg=${message}`);
const encodedMessage = encodeURIComponent(message);
history.push(`/playground/${chat.uuid}?initiateChatMsg=${encodedMessage}`);
} catch (err: any) {
setNotificationErrorMessage(`Error creating chat. Please try again later.`);
console.log('Error: ' + err.message);
Expand Down

0 comments on commit 3356c4e

Please sign in to comment.