Skip to content

fix: guard against null body in notifyCollab to prevent move partial_failure - #267

Merged
kptdobe merged 1 commit into
mainfrom
fix/notify-collab-null-body
Apr 29, 2026
Merged

kptdobe merged 1 commit into
mainfrom
fix/notify-collab-null-body

Conversation

@kptdobe

@kptdobe kptdobe commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • notifyCollab (used by copyFile) called resp.body.cancel() with no null guard
  • When the collab service returns a bodyless response, this threw TypeError: Cannot read properties of null (reading 'cancel') inside the finally block of copyFile
  • Because finally exceptions replace the return value, the successful S3 CopyObjectCommand result was discarded — deleteObject was never called, leaving files duplicated at both source and destination
  • The move endpoint returned partial_failure 500 instead of 204

Fix: resp.body?.cancel() — one character, safe for all cases including undefined.

This bug was revealed by PR #266 (move error logging), which made previously silent partial_failure 500s visible in Cloudflare Worker logs.

Test plan

  • New regression test: does not throw when collab response has null body in test/storage/utils/object.test.js
  • All existing notifyCollab tests still pass

🤖 Generated with Claude Code

…failure

notifyCollab called resp.body.cancel() unconditionally. When the collab
service returns a bodyless response, this threw TypeError in the finally
block of copyFile, cancelling the successful copy return value and causing
moves to fail with partial_failure 500 — leaving files duplicated at both
source and destination instead of being renamed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kptdobe
kptdobe requested a review from bosschaert April 29, 2026 13:57
@kptdobe
kptdobe merged commit b21c4eb into main Apr 29, 2026
6 checks passed
@kptdobe
kptdobe deleted the fix/notify-collab-null-body branch April 29, 2026 14:36
adobe-bot pushed a commit that referenced this pull request Apr 29, 2026
## [1.6.3](v1.6.2...v1.6.3) (2026-04-29)

### Bug Fixes

* buffer current.body to ArrayBuffer before putVersion to survive SDK retries ([#268](#268)) ([47562f1](47562f1))
* guard against null body in notifyCollab to prevent move partial_failure ([#267](#267)) ([b21c4eb](b21c4eb))
@adobe-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.6.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants