diff --git a/src/openforms/registrations/contrib/microsoft_graph/plugin.py b/src/openforms/registrations/contrib/microsoft_graph/plugin.py index 48260e326a..4a30eec388 100644 --- a/src/openforms/registrations/contrib/microsoft_graph/plugin.py +++ b/src/openforms/registrations/contrib/microsoft_graph/plugin.py @@ -68,7 +68,7 @@ def register_submission(self, submission: Submission, options: dict) -> None: data["__metadata__"] = {"submission_language": submission.language_code} uploader.upload_json(data, folder_name / "data.json") - for attachment in submission.attachments.all(): + for attachment in submission.attachments.order_by("pk"): uploader.upload_django_file( attachment.content, folder_name / "attachments" / attachment.get_display_name(), diff --git a/src/openforms/registrations/contrib/microsoft_graph/tests/test_backend.py b/src/openforms/registrations/contrib/microsoft_graph/tests/test_backend.py index 6e06f8fbc9..4bdc7acc15 100644 --- a/src/openforms/registrations/contrib/microsoft_graph/tests/test_backend.py +++ b/src/openforms/registrations/contrib/microsoft_graph/tests/test_backend.py @@ -101,8 +101,9 @@ def test_submission(self, upload_mock): set_submission_reference(submission) - with patch.object(Account, "is_authenticated", True), patch.object( - Drive, "get_root_folder", return_value=MockFolder() + with ( + patch.object(Account, "is_authenticated", True), + patch.object(Drive, "get_root_folder", return_value=MockFolder()), ): graph_submission = MSGraphRegistration("microsoft-graph") graph_submission.register_submission(submission, self.options)