RocketChat / RocketChat/Rocket.Chat

Team Channels search returns no results when query includes leading or trailing whitespace

Open
#41,697 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

Searching for channels in the Team Channels panel returns no results when the search query contains leading or trailing whitespace.

For example, searching for general correctly returns the matching team channel, while searching for general , general, or general returns no results even though the search term is otherwise identical.

Steps to reproduce:
  1. Open any team.
  2. Open the Team Channels panel.
  3. Search for an existing channel using its name (for example, general) and verify that it is returned.
  4. Search again using the same channel name with leading or trailing whitespace (for example, general , general, or general ).
Expected behavior:

Leading and trailing whitespace should be ignored, and the search should return the same channels as the trimmed search term.

Actual behavior:

No matching channels are returned when the search query contains leading or trailing whitespace.

Screenshot / Screen Recording:

https://github.com/user-attachments/assets/ac57458a-2337-4fd6-bb40-ef4152b312e4

Server Setup Information:
  • Version of Rocket.Chat Server: 8.7.0-develop
  • License Type: Community
  • Number of Users: N/A
  • Operating System: Ubuntu (WSL2)
  • Deployment Method: Development
  • Number of Running Instances: 1
  • DB Replicaset Oplog: N/A
  • NodeJS Version: 22.22.1
  • MongoDB Version: 7.0.16
Client Setup Information
  • Desktop App or Browser Version: Google Chrome
  • Operating System: Windows 11
Additional context

The issue is reproducible with both leading and trailing whitespace in the search query. Empty searches continue to behave as expected and display the available team channels.

Relevant logs:

No relevant server or browser errors were observed.

Contributor guide

Open the 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.

Research direction

Start at the Team Channels panel and trace how its search query is handled, then reproduce the issue with leading and trailing whitespace around an existing channel name such as general. Done means whitespace-padded queries return the same channels as the trimmed query, while empty searches continue to show available channels; verify the behavior in the Team Channels search flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.