Fix: handle uuid fields created under mariadb and Django 4 (#8034)

This commit is contained in:
shamoon 2024-10-28 06:54:16 -07:00 committed by GitHub
parent 335c6c3820
commit 28fdb170bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 128 additions and 7 deletions

View file

@ -406,7 +406,17 @@ class DocumentViewSet(
from documents import index
index.remove_document_from_index(self.get_object())
return super().destroy(request, *args, **kwargs)
try:
return super().destroy(request, *args, **kwargs)
except Exception as e:
if "Data too long for column" in str(e):
logger.warning(
"Detected a possible incompatible database column. See https://docs.paperless-ngx.com/troubleshooting/#convert-uuid-field",
)
logger.error(f"Error deleting document: {e!s}")
return HttpResponseBadRequest(
"Error deleting document, check logs for more detail.",
)
@staticmethod
def original_requested(request):