bugfix/thumbnails on update

Bug 1 & 2 (webdav_handler.rs handle_put() update branch):
  - After a successful file update via WebDAV PUT, if the content type is a supported image:
    a. delete_thumbnails(file_id) — evicts the stale moka cache entry
    b. Spawns a background task to read the new blob bytes and call generate_all_sizes_background_from_bytes

  Bug 3 & 4 (dedup_service.rs):
  - Added thumbnail_service: Option<Arc<ThumbnailService>> field with a with_thumbnail_service() builder
  - In remove_legacy_reference(): calls delete_blob_thumbnails(hash) when ref_count hits 0
  - In remove_manifest_reference(): calls delete_blob_thumbnails(file_hash) when manifest's last ref is dropped
  - Wired in di.rs — the thumbnail service is created before dedup service so the ordering works cleanly
This commit is contained in:
Edouard Vanbelle
2026-04-27 20:41:19 +02:00
parent f62562d585
commit 9f57776ec9
6 changed files with 105 additions and 2 deletions
@@ -163,6 +163,12 @@ async fn handle_assemble(
)
.await
.map_err(|e| AppError::internal_error(format!("Failed to update file: {}", e)))?;
state
.core
.refresh_thumbnails_after_update(dto.id.clone(), dto.etag.clone(), &content_type)
.await;
Some(dto.etag)
} else {
// For new files we still need to read the temp file since create_file takes &[u8].