feat(web): include referenced media in the session-log export

The export ZIP now carries every image any included log references under
media/<attachmentId>.<ext>, read and verified from the attachment store with
one entry per shared image. The endpoint requires the attachments service
alongside persistence and session-query; a referenced image that cannot be
read fails the stream like a missing descendant.
This commit is contained in:
_Kerman
2026-08-11 14:08:58 +08:00
parent c8a201bebd
commit c2569c3f9d
9 changed files with 350 additions and 61 deletions

View File

@@ -3435,15 +3435,16 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
// root artifact 404 before any zip byte is produced. The root content
// read here is reused as the first zip entry, so nothing is read twice.
const deps = sessionLogExportDeps(ctx)
if (deps.sessionQuery === undefined || deps.sessionPersistence === undefined) {
if (deps.sessionQuery === undefined || deps.sessionPersistence === undefined || deps.attachments === undefined) {
return new Response(
'session log export is unavailable: missing session-query or session-persistence service',
'session log export is unavailable: missing session-query, session-persistence, or attachments service',
{ status: 500 },
)
}
const ready: SessionLogExportReady = {
sessionQuery: deps.sessionQuery,
sessionPersistence: deps.sessionPersistence,
attachments: deps.attachments,
}
let root: SessionRawArtifact | undefined
try {