Skip to content

Missing Error Handling in Avatar Upload Components #37895

@MrKalyanKing

Description

@MrKalyanKing

Description:

Two avatar upload components have incomplete error handling:

  1. RoomAvatarEditor: Missing FileReader.onerror handler, causing silent failures when file reading errors occur
  2. 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

  1. Go to any room → Room Info → Edit
  2. Open Browser DevTools Console (F12)
  3. Try Simulated FileReader failure (I have tested locally)
  4. Click "Upload" in Room Avatar section
  5. Select any image file
  6. Observe: No error message appears (Console shows "BUG: No onerror handler!")

Bug 2: UserAvatarEditor - Missing Format Validation Error

  1. Go to http://localhost:3000/account/profile
  2. Click "Upload" button
  3. Select a non-image file (e.g., .txt file)
  4. 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 readFileAsDataURL utility (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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions