RocketChat / RocketChat/Rocket.Chat
Directory Users search does not ignore leading or trailing whitespace in search term
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
Directory → Users search does not ignore leading or trailing whitespace in the search term.
Searching with leading or multiple trailing spaces fails to find existing users, while searching without extra whitespace works as expected.
Steps to reproduce:
- Open Directory → Users.
- Search for the following terms:
preetipreetipreetipreetipreeti
- Observe the search results.
Expected behavior:
Leading and trailing whitespace should be ignored during search. The following inputs should all return the same matching user:
preetipreetipreetipreetipreeti
Searches containing whitespace within the username (e.g. pre eti) should not return a match.
Actual behavior:
Searches with leading or multiple trailing whitespace do not return matching users, even though the same search without extra whitespace works correctly.
Before fix:
Server Setup Information:
- Version of Rocket.Chat Server: 8.7.0-develop
- License Type: Community
- Number of Users: N/A
- Operating System: Ubuntu 24.04 (WSL2)
- Deployment Method: Local development
- Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- NodeJS Version: 22.22.1
- MongoDB Version: 7.0.16
Client Setup Information
- Desktop App or Browser Version: Google Chrome (latest)
- Operating System: Windows 11
Additional context
The issue only affects Directory → Users search.
Observed behavior:
| Search Input | Result |
|---|---|
preeti |
✅ Found |
preeti |
❌ Not Found |
preeti |
✅ Found |
preeti |
❌ Not Found |
preeti |
❌ Not Found |
pre eti |
❌ Not Found |
Relevant logs:
No relevant server or browser errors were observed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Directory → Users search entry point and reproduce the issue with the listed inputs, including leading, trailing, and internal whitespace. The fix is complete when leading and trailing whitespace produce the same user results as the trimmed term, while whitespace within the username still produces no match.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100