Fix: include last-modified in doc etag (#13044)

This commit is contained in:
shamoon
2026-06-22 18:18:57 -07:00
committed by GitHub
parent 7bf2a9ff82
commit e75946847e
2 changed files with 27 additions and 4 deletions
+3 -3
View File
@@ -70,13 +70,13 @@ def suggestions_last_modified(request, pk: int) -> datetime | None:
def metadata_etag(request, pk: int) -> str | None:
"""
Metadata is extracted from the original file, so use its checksum as the
ETag
Metadata responses include metadata as well as document fields, so include
the modification time with the checksum so metadata-only changes invalidate cache.
"""
doc = resolve_effective_document_by_pk(pk, request).document
if doc is None:
return None
return doc.checksum
return f"{doc.checksum}:{doc.modified.isoformat()}"
def metadata_last_modified(request, pk: int) -> datetime | None: