Fixhancement: version-aware thumbnail etag (#12754)

This commit is contained in:
shamoon authored and GitHub committed 2026-05-08 08:26:37 -07:00
1 parent 268ded92bc
commit 978e54ab52
4 files changed
+54 -2

No files matched your search

+11
View File
@@ -117,6 +117,17 @@ def preview_last_modified(request, pk: int) -> datetime | None:
return doc.modified
def thumbnail_etag(request: Any, pk: int) -> str | None:
"""
Thumbnails are version-dependent, so use the effective document checksum as
the ETag to invalidate cache when the latest version changes.
"""
doc = resolve_effective_document_by_pk(pk, request).document
if doc is None:
return None
return doc.checksum
def thumbnail_last_modified(request: Any, pk: int) -> datetime | None:
"""
Returns the filesystem last modified either from cache or from filesystem.