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:
@@ -972,6 +972,15 @@ async fn handle_put(
|
||||
);
|
||||
}
|
||||
|
||||
state
|
||||
.core
|
||||
.refresh_thumbnails_after_update(
|
||||
file_dto.id.clone(),
|
||||
file_dto.etag.clone(),
|
||||
&content_type,
|
||||
)
|
||||
.await;
|
||||
|
||||
Ok(Response::builder()
|
||||
.status(StatusCode::NO_CONTENT)
|
||||
.body(Body::empty())
|
||||
|
||||
@@ -288,7 +288,19 @@ async fn put_file(
|
||||
let _ = tokio::fs::remove_file(&temp_path).await;
|
||||
|
||||
match result {
|
||||
Ok(_) => StatusCode::OK.into_response(),
|
||||
Ok(file_dto) => {
|
||||
state
|
||||
.app_state
|
||||
.core
|
||||
.refresh_thumbnails_after_update(
|
||||
file_dto.id.clone(),
|
||||
file_dto.etag.clone(),
|
||||
&content_type,
|
||||
)
|
||||
.await;
|
||||
|
||||
StatusCode::OK.into_response()
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("WOPI PutFile failed: {}", e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR.into_response()
|
||||
|
||||
Reference in New Issue
Block a user