feat(storage): carry an archived version's mime type through the query

The API returns it and the mapper dropped it, so nothing downstream could
tell an image from a PDF. The archived preview needs it to render.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3euXsz25sTybsGTcxCFfn
This commit is contained in:
Claude committed 2026-10-05 13:47:02 +00:00
1 parent 481823e4c5
commit 48ddb59fef
2 files changed
+6 -1

No files matched your search

@@ -9,7 +9,7 @@ const row = (overrides: Record<string, unknown>) =>
updated_at: '2026-01-01T00:00:00Z',
created_at: '2026-01-01T00:00:00Z',
last_accessed_at: '2026-01-01T00:00:00Z',
metadata: { size: 100 },
metadata: { size: 100, mimetype: 'image/jpeg' },
...overrides,
}) as any
@@ -30,6 +30,8 @@ describe('toArchivedObjects', () => {
expect(archived[0].path).toBe('folder/photo.jpg')
expect(archived[0].archivedAt).toBe('2026-02-01T00:00:00Z')
expect(archived[0].currentVersion.versionId).toBe('v1')
// The preview needs it to decide what to render.
expect(archived[0].currentVersion.mimeType).toBe('image/jpeg')
})
it('ignores a live object', () => {
@@ -14,6 +14,8 @@ export interface ArchivedObjectVersion {
size: number
createdAt: string
action: ObjectVersionAction
/** What the preview renders from. A delete marker carries no metadata. */
mimeType?: string
}
export interface ArchivedObject {
@@ -43,6 +45,7 @@ const toVersion = (object: StorageObjectV2, action: ObjectVersionAction) => ({
size: Number(object.metadata?.size ?? 0),
createdAt: object.created_at ?? object.updated_at ?? '',
action,
mimeType: object.metadata?.mimetype ?? undefined,
})
/** An object is archived when the row currently at its path is a delete marker. */