Fixed multipart upload abort logic and missing BucketName in cleanup#56
Conversation
WalkthroughBumps package to v3.3.0, updates changelog, sets default multipart part size to 10 MB, and simplifies multipart-upload error handling by replacing a parts-enumeration cleanup with a single AbortMultipartUploadAsync call and rethrowing the original exception. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant UploadObject
participant S3 as "AmazonS3 Service"
Caller->>UploadObject: Start UploadMultipart(...)
UploadObject->>S3: CreateMultipartUpload (Init)
S3-->>UploadObject: UploadId
UploadObject->>S3: UploadPart(s)...
S3-->>UploadObject: Error (exception thrown)
UploadObject->>S3: AbortMultipartUpload(UploadId)
S3-->>UploadObject: Abort response (or error swallowed)
UploadObject-->>Caller: Rethrow original exception
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Frends.AmazonS3.UploadObject/CHANGELOG.md`:
- Around line 3-5: Update the 3.3.0 changelog entry to follow the repository's
Keep a Changelog format: add the missing space after the dash so the line reads
"- Fixed missing BucketName/Key in abort cleanup..." (locate the "## [3.3.0] -
2025-10-17" block and the line starting with "-Fixed"), and correct the release
date for 3.3.0 so the release history is monotonic (replace the erroneous
"2025-10-17" with the proper 2026-04-xx date corresponding to this PR or the
actual release date).
In `@Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs`:
- Around line 260-275: The catch block currently attempts to call
client.AbortMultipartUploadAsync using initResponse and then rethrows, but if
AbortMultipartUploadAsync throws it will overwrite the original exception and
lose the root cause; also initResponse is effectively always non-null because
InitiateMultipartUploadAsync runs before the try. Wrap the abort call in its own
try/catch so any exception from AbortMultipartUploadAsync is logged/ignored and
does not replace the original (use a nested try/catch around
AbortMultipartUploadAsync and swallow or log the abort error), and either remove
the redundant initResponse null-check or move the InitiateMultipartUploadAsync
call inside the outer try so the initResponse guard is meaningful; reference
AbortMultipartUploadAsync, AbortMultipartUploadRequest, initResponse and
InitiateMultipartUploadAsync when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5bb6a628-9752-4518-be96-4c8c757e0afd
📒 Files selected for processing (3)
Frends.AmazonS3.UploadObject/CHANGELOG.mdFrends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject.csprojFrends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs`:
- Around line 262-277: The abort block currently passes the same
cancellationToken (used for UploadPartAsync/CompleteMultipartUploadAsync) to
client.AbortMultipartUploadAsync which can be already canceled; change the call
to use a fresh non-canceled token (e.g. CancellationToken.None or a new
CancellationToken) when invoking client.AbortMultipartUploadAsync so the
AbortMultipartUploadRequest (constructed with input.BucketName, Key = path,
UploadId = initResponse.UploadId) is sent to S3 even if the original token was
canceled; keep the surrounding try/catch that swallows abort errors to allow the
original exception to be rethrown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0c3dfbb9-a8af-4de0-8411-a784c6073176
📒 Files selected for processing (3)
Frends.AmazonS3.UploadObject/CHANGELOG.mdFrends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/Definitions/Connection.csFrends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs
✅ Files skipped from review due to trivial changes (1)
- Frends.AmazonS3.UploadObject/CHANGELOG.md
Please review my changes :)
Task Update PR template
Review Checklist
Summary by CodeRabbit
Version 3.3.0
Bug Fixes
Chores
Documentation