RocketChat / RocketChat/Rocket.Chat
Bug Report: File search fails due to unescaped special characters (parentheses) and untrimmed whitespace in chat room
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
When searching for files inside a chat room, the search input field does not sanitize or normalize the query string. This causes two distinct functional failures:
1.Untrimmed Spaces: Accidentally typing leading or trailing whitespaces results in an empty search state because the system treats the spaces as part of the literal filename.
2.Regex Evaluation Breakage: Special regular expression characters—specifically parentheses () commonly found in OS-duplicated files (e.g., file(1).pdf)—are not escaped.
Steps to reproduce:
- Create a direct message room with another user.
- Send files and videos to each other, some of the filename should have special character like parenthesis.
- Search for files by clicking on the top right of the chatroom.
- Try searching for a file with exact name but with leading or trailing white space. Also try searching for the file whose name has a parenthesis.
Expected behavior:
Expected behavior for the search functionality is to ignore the white space and then display the result. Also the parenthesis should be treated as a string and then they should display the required result.
Actual behavior:
For both searches the system returns empty results.
https://github.com/user-attachments/assets/34d88f1a-5266-4339-a948-88ef2981186e
Server Setup Information:
- Version of Rocket.Chat Server: 8.7.0-develop
- License Type:Community
- Number of Users: 2
- Operating System: Fedora
- Deployment Method: Development
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: 22.22.3
- MongoDB Version:
Client Setup Information
- Browser: Firefox
- Operating System: Fedora 43
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 from the chat room file-search input described in the reproduction steps and trace how its query is handled. Verify the behavior with filenames containing leading or trailing whitespace and parentheses; done means trimmed searches return matching files and parentheses are treated literally instead of producing empty results.
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
- Mostly clear
- Newbie friendliness
- 65/100