Keep the size of an uploaded attachment when the uploader deletes its file by gpunto · Pull Request #6809 · GetStream/stream-chat-android · GitHub
Skip to content

Keep the size of an uploaded attachment when the uploader deletes its file - #6809

Merged
gpunto merged 1 commit into
developfrom
fix/uploaded-file-size
Oct 12, 2026
Merged

gpunto merged 1 commit into
developfrom
fix/uploaded-file-size

Conversation

@gpunto

@gpunto gpunto commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Goal

AttachmentUploader read an uploaded file's size after the FileUploader returned. A custom uploader that deletes the file once it's uploaded made the attachment go out with file_size: 0.

Closes AND-1643

Port of #6808 to develop.

Implementation

  • The size of the file to upload (after the FileTransformer) is read before the upload and used for the uploaded attachment.

Testing

AttachmentUploaderTests covers an uploader that deletes the file during the upload.

On an emulator (on v6, where the code is the same), with a custom uploader that deletes each file before returning success: the server stored file_size: 0 for a file, an audio and an image attachment; with the fix, it stores the right sizes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Uploaded attachments now retain the transformed file’s size even when the file is removed during upload.

@gpunto gpunto added the pr:bug Bug fix label Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.23 MB 6.23 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.53 MB 11.53 MB 0.00 MB 🟢
stream-chat-android-compose 13.21 MB 13.21 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review October 12, 2026 09:38
@gpunto
gpunto requested a review from a team as a code owner October 12, 2026 09:38
@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22061e8e-ffd9-498a-8b52-af269bb15916

📥 Commits

Reviewing files that changed from the base of the PR and between 3724813 and a9de065.


📒 Files selected for processing (2)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/attachment/AttachmentUploader.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/attachment/AttachmentUploaderTests.kt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.



📝 Walkthrough

Walkthrough

uploadAttachment now reads the transformed file size before upload and passes it to the image and file upload paths. Successful attachment augmentation uses this captured size instead of reading the file after upload. A test deletes the transformed image during the upload call and verifies that the returned attachment retains its original size.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to a9de0

No actionable issue was identified that would prevent merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly describes the main fix: preserving an uploaded attachment's size when the uploader deletes the file.
Description check Passed The description includes the goal, implementation, issue reference, and testing details. The omitted UI and checklist sections are not critical for this non-UI change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit with a file-size note,
I watch the upload sail afloat.
Though the file hops out of sight,
Its measured bytes arrive just right.
I twitch my nose and softly cheer,
The size stays safe from start to clear.

Comment @coderabbitai help to get the list of available commands.

@gpunto
gpunto added this pull request to the merge queue Oct 12, 2026
Merged via the queue into develop with commit c062f70 Oct 12, 2026
20 of 21 checks passed
@gpunto
gpunto deleted the fix/uploaded-file-size branch October 12, 2026 14:05
@stream-public-bot stream-public-bot added the released Included in a release label Oct 16, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants