RocketChat / RocketChat/Rocket.Chat
Missing Error Handling in Avatar Upload Components
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
Two avatar upload components have incomplete error handling:
- RoomAvatarEditor: Missing FileReader.onerror handler, causing silent failures when file reading errors occur
- UserAvatarEditor: Missing error message when image format validation fails
Users receive no feedback when avatar uploads fail, leading to confusion.
Steps to reproduce:
Bug 1: RoomAvatarEditor - Missing FileReader Error Handling
- Go to any room → Room Info → Edit
- Open Browser DevTools Console (F12)
- Try Simulated FileReader failure (I have tested locally)
- Click "Upload" in Room Avatar section
- Select any image file
- Observe: No error message appears (Console shows "BUG: No onerror handler!")
Bug 2: UserAvatarEditor - Missing Format Validation Error
- Go to http://localhost:3000/account/profile
- Click "Upload" button
- Select a non-image file (e.g., .txt file)
- Observe: No error message appears, avatar doesn't change
Expected behavior:
- Error toast messages should appear when:
- FileReader fails (corrupted files, too large, permission errors)
- Image format validation fails (non-image files, invalid formats)
- Users should receive clear feedback about upload failures
Actual behavior:
- RoomAvatarEditor: No error message when FileReader fails
- UserAvatarEditor: No error message when format validation fails
- Both components fail silently, leaving users confused
Server Setup Information:
- Version of Rocket.Chat Server: develop
- License Type: Community
- Operating System: windows 11
- Deployment Method: Development (meteor)
Client Setup Information
- Desktop App or Browser Version: Chrome
- Operating System: Windows 11
Additional context
Solution:
- Use existing
readFileAsDataURLutility (has proper error handling) - Add error messages for format validation failures
- Ensure both components handle all error scenarios
Relevant logs:
Browser Console:
FileReader error occurred but NO onerror handler is registered!
BUG: No onerror handler!
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
Locate RoomAvatarEditor and UserAvatarEditor, then read the existing readFileAsDataURL utility first to understand its error handling. Verify both upload flows report FileReader failures and invalid image formats with clear error toasts instead of failing silently.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100