Skip to content

Commit b8132ef

Browse files
committed
🐛(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.
1 parent 2ede746 commit b8132ef

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and this project adheres to
3333

3434
- 🐛(backend) fix create document via s2s if sub unknown but email found #543
3535
- 🐛(frontend) hide search and create doc button if not authenticated #555
36+
- 🐛(backend) race condition creation issue #556
3637

3738
## [1.10.0] - 2024-12-17
3839

src/backend/core/api/viewsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def _authorize_subrequest(self, request, pattern):
676676

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

0 commit comments

Comments
 (0)