RocketChat / RocketChat/Rocket.Chat

Admin Users search does not ignore leading or multiple trailing whitespace in search term

Open
#41,530 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

The search functionality in Administration → Users does not handle leading or multiple trailing whitespace consistently.

Searching with leading whitespace or multiple trailing spaces fails to find matching users, even though the search term itself is valid.

The Administration → Rooms search trims leading and trailing whitespace correctly, making the behavior inconsistent across the admin interface.

Steps to reproduce
  1. Go to Administration → Users.
  2. Search for an existing user, for example:
    • preeti
    • preeti
    • preeti
    • preeti
  3. Observe the search results.
Expected behavior

Leading and trailing whitespace should be ignored before performing the search.

The following inputs should all return the same user:

  • preeti
  • preeti
  • preeti
  • preeti
  • preeti

Only whitespace inserted within the search term (e.g. pre eti) should affect the search.

Actual behavior

Observed results:

Search Input Result
preeti ✅ Found
preeti ❌ Not Found
preeti ✅ Found
preeti ❌ Not Found
preeti ❌ Not Found
pre eti ❌ Not Found
Additional context

Screen recording demonstrating the inconsistent search behavior:

https://github.com/user-attachments/assets/d4617a6f-f59f-447c-8412-8a9c3a5c0ca2

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

The behavior is reproducible consistently.

The Administration → Rooms search correctly handles leading and trailing whitespace, suggesting this behavior is specific to the Users search implementation.

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

Locate the Administration → Users search implementation and compare it with the Administration → Rooms search, which already handles surrounding whitespace correctly. Reproduce the listed inputs, then update the Users behavior so leading and trailing whitespace is ignored while internal whitespace remains significant. Add or run the relevant search tests and verify all expected inputs return the same user.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.