You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep the size of an uploaded attachment when the uploader deletes its file - #6809
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.
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.
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 | 4 | 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
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
The title clearly describes the main fix: preserving an uploaded attachment's size when the uploader deletes the file.
Description check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
AttachmentUploaderread an uploaded file's size after theFileUploaderreturned. A custom uploader that deletes the file once it's uploaded made the attachment go out withfile_size: 0.Closes AND-1643
Port of #6808 to
develop.Implementation
FileTransformer) is read before the upload and used for the uploaded attachment.Testing
AttachmentUploaderTestscovers 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 storedfile_size: 0for a file, an audio and an image attachment; with the fix, it stores the right sizes.🤖 Generated with Claude Code
Summary by CodeRabbit