Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#1,276 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
api

Research direction

Start in packages/api/src/EmbeddedChatApi.ts at getSearchMessages and review the URL construction in getUserStatus, userInfo, and userData. Verify the behavior with values containing &, #, and +; done means these values reach the API as the intended search text, user ID, or username rather than altering the query.

Written by the indexing model from the issue text.

Description

Searching for anything with &, #, or + in it returns wrong results or nothing at all.

getSearchMessages in EmbeddedChatApi.ts (line 1124) builds the URL with a template literal:

`${this.host}/api/v1/chat.search?roomId=${this.rid}&searchText=${text}`

The text param goes straight into the URL without encoding. So:

  • hello & goodbye — the & starts a new query param. Server receives searchText=hello and a stray goodbye param
  • #channel — the # is treated as a URL fragment. searchText arrives as an empty string
  • hello world+test — the + is read as a space. Server gets hello world test

Same pattern in three other methods:

  • getUserStatus (line 1236) — userId=${reqUserId}
  • userInfo (line 1253) — userId=${reqUserId}
  • userData (line 1270) — username=${username}

The userId ones are less likely to hit this in practice since IDs are usually alphanumeric, but usernames with special characters would break userData.

File: packages/api/src/EmbeddedChatApi.ts

Dominant language
JavaScript
Stars
167
Forks
382
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RocketChat/EmbeddedChat

All issues in RocketChat/EmbeddedChat

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.