Skip to content

Incomplete avatars are displayed for thread subscribers when avatar upload is not completed #41802

Description

@olehhlynka

Description

Rocket.Chat displays an incomplete avatar for a thread subscriber even though the avatar upload was not successfully completed.

When an avatar upload is interrupted, the avatar object is uploaded to object storage and its reference remains in the database, but the avatar is not marked as complete (complete: true). The thread subscriber list nevertheless uses this incomplete avatar reference when fetching the subscriber's avatar.

This can result in a corrupted/incomplete avatar being displayed for a user who should have no avatar. The issue is particularly visible when the affected user is one of the first two thread subscribers, since Rocket.Chat displays only the first two subscribers in the thread UI.

Steps to reproduce:

  1. Use a user who does not currently have an avatar.
  2. Start uploading an avatar for the user.
  3. Interrupt or cancel the avatar upload before it completes.
  4. Create or open a thread.
  5. Have the affected user subscribe to the thread.
  6. Open the thread subscriber list.
  7. Ensure the affected user is one of the first two subscribers displayed.
  8. Observe the avatar displayed for the affected user.

Expected behavior:

If an avatar upload is incomplete and the avatar record does not have complete: true, Rocket.Chat should not use the stored object-storage reference when displaying the user's avatar.

The user's default avatar should be displayed instead, using the first letter of their name.

Actual behavior:

The thread subscriber list uses the object-storage reference for the incomplete avatar and displays the resulting corrupted/incomplete avatar.

The database contains a reference to the avatar object, but the avatar is not marked as complete (complete: true). Despite this, the avatar is returned/used when fetching the thread subscribers.

Server Setup Information:

  • Version of Rocket.Chat Server: 8.7.0
  • License Type:
  • Number of Users:
  • Operating System:
  • Deployment Method:
  • Number of Running Instances:
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version:

Client Setup Information

  • Desktop App or Browser Version:
  • Operating System:

Additional context

The issue appears to be related to avatar retrieval for thread subscribers rather than the normal user profile avatar display.

The avatar object itself exists in object storage, but the corresponding database record does not indicate a successfully completed upload (complete: true). The subscriber avatar retrieval appears to rely on the stored object reference without checking whether the upload was completed.

Rocket.Chat threads display only the first two subscribers, so the issue is observable when the affected subscriber is among those first two users.

Relevant logs:

No relevant logs available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions