🐛(backend) creation race condition

3 requests we able to create a document:
- POST document request
- GET collaboration-auth
- GET media-auth

If the 2 last were faster than the first, a
document was created without the necessary
informations.
This commit is contained in:
Anthony LC
2025-01-15 11:57:22 +01:00
committed by Anthony LC
parent 2ede746d8a
commit b8132ef393
2 changed files with 2 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ and this project adheres to
- 🐛(backend) fix create document via s2s if sub unknown but email found #543
- 🐛(frontend) hide search and create doc button if not authenticated #555
- 🐛(backend) race condition creation issue #556
## [1.10.0] - 2024-12-17

View File

@@ -676,7 +676,7 @@ class DocumentViewSet(
# Fetch the document and check if the user has access
try:
document, _created = models.Document.objects.get_or_create(pk=pk)
document = models.Document.objects.get(pk=pk)
except models.Document.DoesNotExist as exc:
logger.debug("Document with ID '%s' does not exist", pk)
raise drf.exceptions.PermissionDenied() from exc