Skip to content

fix(r2): report source digest/size for mounted-blob HEAD (builds on #121)#139

Open
m-ferrero wants to merge 3 commits into
cloudflare:mainfrom
aggrega-ai:fix/mounted-blob-head-pr121
Open

fix(r2): report source digest/size for mounted-blob HEAD (builds on #121)#139
m-ferrero wants to merge 3 commits into
cloudflare:mainfrom
aggrega-ai:fix/mounted-blob-head-pr121

Conversation

@m-ferrero

Copy link
Copy Markdown

Problem

A HEAD on a mounted (cross-repo) blob returns the symlink object's own digest/size instead of the source blob's. #121 set out to fix this; this PR builds on that approach and corrects a defect in it: the symlink checksum-mismatch test compares the raw R2 checksum (ArrayBuffer) to a hex string, which does not type-check and, at runtime, is always true — so every digest-addressed blob would be routed through symlink resolution.

Solution

Credit and carry #121's approach (record the source digest/size on the symlink object's metadata; resolve HEAD through layerExists, with a fallback for symlinks created before the fix), then fix the comparison to put full sha256:… digest strings on both sides (via hexToDigest), so a normal blob compares equal (no mismatch) and only a real symlink object mismatches.

Tests

Adds regression coverage for cross-repo mounted-blob HEAD returning the source digest/size.

Builds on #121 by @mushanyoung.

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.

2 participants