fix(lifecycle): pass blob content_hash to file lifecycle hooks, not etag

The five FileLifecycleHook call sites handed dto.etag (format
"{blob_hash[..16]}-{modified_at}") to the blob_hash parameter. Blob
lookups keyed by that value can never resolve, so background thumbnail
generation and audio metadata extraction silently failed on every
upload/copy/update, pushing all thumbnail work onto the request path.

Pass dto.content_hash — the raw full BLAKE3 hash already carried by
FileDto — instead.

https://claude.ai/code/session_01QxwJDHqQhbMkHK333QtMme
This commit is contained in:
Claude
2026-06-10 12:44:13 +00:00
parent 26b396490c
commit c3b853abd2
2 changed files with 5 additions and 5 deletions
@@ -151,7 +151,7 @@ impl FileManagementService {
let dto = FileDto::from(copied_file); let dto = FileDto::from(copied_file);
if let Some(hook) = &self.file_lifecycle_hook { if let Some(hook) = &self.file_lifecycle_hook {
hook.on_file_copied(&dto.id, &dto.etag, &dto.mime_type, file_id); hook.on_file_copied(&dto.id, &dto.content_hash, &dto.mime_type, file_id);
} }
Ok(dto) Ok(dto)
} }
@@ -177,7 +177,7 @@ impl FileUploadUseCase for FileUploadService {
); );
self.maybe_update_storage_usage(&dto); self.maybe_update_storage_usage(&dto);
if let Some(hook) = &self.file_lifecycle_hook { if let Some(hook) = &self.file_lifecycle_hook {
hook.on_file_created(&dto.id, &dto.etag, &dto.mime_type, is_new_blob); hook.on_file_created(&dto.id, &dto.content_hash, &dto.mime_type, is_new_blob);
} }
Ok(dto) Ok(dto)
} }
@@ -260,7 +260,7 @@ impl FileUploadUseCase for FileUploadService {
let dto = FileDto::from(file); let dto = FileDto::from(file);
self.maybe_update_storage_usage(&dto); self.maybe_update_storage_usage(&dto);
if let Some(hook) = &self.file_lifecycle_hook { if let Some(hook) = &self.file_lifecycle_hook {
hook.on_file_created(&dto.id, &dto.etag, &dto.mime_type, is_new_blob); hook.on_file_created(&dto.id, &dto.content_hash, &dto.mime_type, is_new_blob);
} }
Ok(dto) Ok(dto)
} }
@@ -337,7 +337,7 @@ impl FileUploadUseCase for FileUploadService {
let updated = file_read.get_file(&file_id).await?; let updated = file_read.get_file(&file_id).await?;
let dto = FileDto::from(updated); let dto = FileDto::from(updated);
if let Some(hook) = &self.file_lifecycle_hook { if let Some(hook) = &self.file_lifecycle_hook {
hook.on_file_updated(&file_id, &dto.etag, content_type); hook.on_file_updated(&file_id, &dto.content_hash, content_type);
} }
return Ok(dto); return Ok(dto);
} }
@@ -375,7 +375,7 @@ impl FileUploadUseCase for FileUploadService {
.await?; .await?;
let dto = FileDto::from(created); let dto = FileDto::from(created);
if let Some(hook) = &self.file_lifecycle_hook { if let Some(hook) = &self.file_lifecycle_hook {
hook.on_file_created(&dto.id, &dto.etag, content_type, is_new_blob); hook.on_file_created(&dto.id, &dto.content_hash, content_type, is_new_blob);
} }
Ok(dto) Ok(dto)
} }