S3: JPEG support for avatar upload + serve #19
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
posta/server#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
posta/server#15 — Operator-uploaded avatar served from the identity's URL
What to build
Extend the imagesniff module and the GET route to accept JPEG alongside
PNG. Unblocks iOS clients, which convert HEIC (camera roll default) to
JPEG before upload and would otherwise fail the PNG-only sniff in S1.
End-to-end behaviour after this slice:
PUT /api/v1/identity/avatarwithContent-Type: image/jpegandvalid JPEG bytes succeeds. The avatar is stored as
avatar-<hash>.jpgunder the per-identity directory; the actor doc'savatarURL ends in.jpg.GET /avatar-<hash>.jpgon the identity's host returns200,Content-Type: image/jpeg, sameCache-Control: max-age=31536000, immutableandETagbehaviour as the PNG path.image/jpeg(or vice versa) stillfails with
400 content-type-mismatch.400 not-an-image— HEIC is intentionally out of scope and therejection makes that visible to clients.
avatar-*.pngand leavesonly the new
avatar-<hash>.jpg(existing storage behaviour from S1is unchanged; just verify it works across extensions).
Acceptance criteria
marker
\xff\xd8\xfffollowed by the byte\xe0(JFIF) /\xe1(EXIF) /\xdb(raw quantization-table — common fromsome encoders).
("jpg", "image/jpeg", nil)for valid JPEG.\xff\xd8\xff\xe0),valid JPEG (
\xff\xd8\xff\xe1), HEICftypbrand (rejection:not-an-image), PNG bytes declared asimage/jpeg(rejection:content-type-mismatch).Content-Type: image/jpegas a valid declaredtype. (Anything else still rejects with
unsupported-media-type.).jpgas well as.png(single pattern for either extension is fine).
a
.jpgURL → GET on that URL returnsContent-Type: image/jpegwith the bytes intact.
per-identity directory contains exactly one file
(
avatar-<newhash>.jpg), andGETon the old.pngURL returns404.go build ./...andgo test ./...pass.Blocked by
posta/server#16 (S1: PNG avatar upload + public GET). Imagesniff,
avatar storage, PUT handler, and GET route all land in S1; this slice
extends them.
Extends imagesniff and the GET route to accept JPEG alongside PNG. iOS clients convert HEIC (camera-roll default) to JPEG before upload, so this slice unblocks iOS launch in tandem with #16.
Acceptance criteria above already function as an agent brief.
Category: enhancement
State: ready-for-agent