Skip to content

feat: add blob HTTP endpoints (unit 8) - #54

Merged
mtiluk merged 1 commit into
mainfrom
feat/blobstore
Sep 10, 2026
Merged

mtiluk merged 1 commit into
mainfrom
feat/blobstore

Conversation

@mtiluk

@mtiluk mtiluk commented Sep 10, 2026

Copy link
Copy Markdown
Owner

PUT/GET /vaults/{name}/blobs/{id}, wired behind APIKeyAuth. PutBlob hashes the body (SHA-256) and rejects a mismatch against the claimed id, short-circuits with 200 if the vault already has that blob (no disk write), otherwise writes via blobstore and records the row via store.PutBlob. GetBlob 404s on blobstore.ErrNotFound and streams the bytes back. store.HasBlob/PutBlob/GetBlob and the Store interface in http.go were fixed to key off vault_id (matching the blobs table's actual primary key) instead of user_id, and PutBlob no longer takes raw content bytes (the blobs table has no such column) - just size_bytes.

Verified end-to-end locally with a real file over curl: hash mismatch, dedup short-circuit, not-found, and cross-user vault scoping all behave as expected.

PUT/GET /vaults/{name}/blobs/{id}, wired behind APIKeyAuth. PutBlob
hashes the body (SHA-256) and rejects a mismatch against the claimed
id, short-circuits with 200 if the vault already has that blob (no
disk write), otherwise writes via blobstore and records the row via
store.PutBlob. GetBlob 404s on blobstore.ErrNotFound and streams the
bytes back. store.HasBlob/PutBlob/GetBlob and the Store interface in
http.go were fixed to key off vault_id (matching the blobs table's
actual primary key) instead of user_id, and PutBlob no longer takes
raw content bytes (the blobs table has no such column) - just
size_bytes.

Verified end-to-end locally with a real file over curl: hash
mismatch, dedup short-circuit, not-found, and cross-user vault
scoping all behave as expected.
@mtiluk
mtiluk merged commit 1695782 into main Sep 10, 2026
1 check passed
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