Skip to content

fix(api): encode query params in search and user lookup URLs#1277

Open
deepak0x wants to merge 2 commits intoRocketChat:developfrom
deepak0x:fix/url-encode-query-params
Open

fix(api): encode query params in search and user lookup URLs#1277
deepak0x wants to merge 2 commits intoRocketChat:developfrom
deepak0x:fix/url-encode-query-params

Conversation

@deepak0x
Copy link
Copy Markdown
Contributor

@deepak0x deepak0x commented Apr 6, 2026

Fixes #1276

getSearchMessages builds URLs with template literals and drops user input straight into the query string without encoding. Search for hello & goodbye and the server gets searchText=hello because the & starts a new param. Search for #channel and searchText arrives empty because # is a URL fragment.

Same thing in getUserStatus, userInfo, and userData. Those are less likely to hit it since user IDs tend to be alphanumeric, but userData takes a username and usernames can have special characters.

Added encodeURIComponent() to all four.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: search queries with &, #, or + return wrong results — URL params not encoded

1 participant