Fix: use JSON for update archive file auditlog entries (#7503)

This commit is contained in:
shamoon 2024-08-19 23:29:24 -07:00 committed by GitHub
parent dac3def6b9
commit a771d2afd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,8 +47,6 @@ from documents.signals import document_updated
from documents.signals.handlers import cleanup_document_deletion
if settings.AUDIT_LOG_ENABLED:
import json
from auditlog.models import LogEntry
logger = logging.getLogger("paperless.tasks")
@ -259,24 +257,20 @@ def update_document_archive_file(document_id):
if settings.AUDIT_LOG_ENABLED:
LogEntry.objects.log_create(
instance=oldDocument,
changes=json.dumps(
{
"content": [oldDocument.content, newDocument.content],
"archive_checksum": [
oldDocument.archive_checksum,
newDocument.archive_checksum,
],
"archive_filename": [
oldDocument.archive_filename,
newDocument.archive_filename,
],
},
),
additional_data=json.dumps(
{
"reason": "Redo OCR called",
},
),
changes={
"content": [oldDocument.content, newDocument.content],
"archive_checksum": [
oldDocument.archive_checksum,
newDocument.archive_checksum,
],
"archive_filename": [
oldDocument.archive_filename,
newDocument.archive_filename,
],
},
additional_data={
"reason": "Update document archive file",
},
action=LogEntry.Action.UPDATE,
)