Skip to content

Fix HeadObject OpenAPI summary and align base64 key decoding#147

Merged
G4brym merged 1 commit into
mainfrom
fix/head-object-summary-and-key-decoding
Mar 9, 2026
Merged

Fix HeadObject OpenAPI summary and align base64 key decoding#147
G4brym merged 1 commit into
mainfrom
fix/head-object-summary-and-key-decoding

Conversation

@G4brym

@G4brym G4brym commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes the OpenAPI summary field in HeadObject from "Get Object" to "Head Object" — this was a copy-paste error that shows up in generated API documentation
  • Aligns the base64 key decoding logic in HeadObject and PutMetadata with GetObject's three-level try-catch fallback

Why

GetObject has three levels of fallback for decoding base64-encoded file keys (to handle various URL encoding edge cases), but HeadObject and PutMetadata — which receive keys the same way via URL params — only had two levels. This inconsistency means certain encoded file keys could successfully download via GetObject but fail when fetching metadata via HeadObject or updating metadata via PutMetadata.

What changed

  • packages/worker/src/modules/buckets/headObject.ts: Fixed summary, added third fallback level for key decoding
  • packages/worker/src/modules/buckets/putMetadata.ts: Added third fallback level for key decoding

Test plan

  • All 78 existing tests pass (7 skipped — same as baseline)
  • Linter passes with no issues

🤖 Generated with Claude Code

- Fix OpenAPI summary in HeadObject from "Get Object" to "Head Object"
- Add missing third-level fallback for base64 key decoding in HeadObject
  and PutMetadata to match GetObject's decoding logic, preventing potential
  failures with certain encoded file keys

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
r2-explorer-docs 25c7968 Commit Preview URL

Branch Preview URL
Mar 07 2026, 09:46 PM

@G4brym

G4brym commented Mar 8, 2026

Copy link
Copy Markdown
Owner Author

Automated Code Review — APPROVED ✅

Review Scores: 5/5 reviewers approved

Summary

Clean, well-scoped PR that fixes a copy-paste error in the HeadObject OpenAPI summary and aligns base64 key decoding fallback logic in HeadObject and PutMetadata with the existing three-level pattern in GetObject. All changes are straightforward and correct.

Review Perspectives

  1. Correctness: ✅ Summary fix is correct; decoding fallback now exactly matches GetObject reference implementation
  2. Security: ✅ No new attack surface — same decoding logic already shipped in GetObject
  3. Performance: ✅ One additional try-catch level is negligible overhead
  4. Code Quality: ✅ Aligns with existing patterns; catch (e)catch removes unused variable
  5. Testing: ✅ All 78 tests pass, linter clean

Minor Suggestions (non-blocking)

  • Code duplication: The base64 key decoding logic is now identical in getObject.ts, headObject.ts, and putMetadata.ts. Consider extracting a shared decodeKey(key: string): string utility to prevent future drift.
  • Test coverage: No dedicated test for the third fallback level (though this also applies to GetObject — could be a follow-up).

🤖 Automated review by prodboard

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant