From c3b853abd214985c043844be9db9560bc81900ef Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 10 Jun 2026 12:44:13 +0000 Subject: [PATCH] fix(lifecycle): pass blob content_hash to file lifecycle hooks, not etag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/application/services/file_management_service.rs | 2 +- src/application/services/file_upload_service.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/application/services/file_management_service.rs b/src/application/services/file_management_service.rs index 453a3a9c..70e5b327 100644 --- a/src/application/services/file_management_service.rs +++ b/src/application/services/file_management_service.rs @@ -151,7 +151,7 @@ impl FileManagementService { let dto = FileDto::from(copied_file); 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) } diff --git a/src/application/services/file_upload_service.rs b/src/application/services/file_upload_service.rs index 9490f7e6..20e18898 100644 --- a/src/application/services/file_upload_service.rs +++ b/src/application/services/file_upload_service.rs @@ -177,7 +177,7 @@ impl FileUploadUseCase for FileUploadService { ); self.maybe_update_storage_usage(&dto); 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) } @@ -260,7 +260,7 @@ impl FileUploadUseCase for FileUploadService { let dto = FileDto::from(file); self.maybe_update_storage_usage(&dto); 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) } @@ -337,7 +337,7 @@ impl FileUploadUseCase for FileUploadService { let updated = file_read.get_file(&file_id).await?; let dto = FileDto::from(updated); 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); } @@ -375,7 +375,7 @@ impl FileUploadUseCase for FileUploadService { .await?; let dto = FileDto::from(created); 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) }