From 7bf68850d3cca0181103d33b29ca5f06a741fec4 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Tue, 28 Mar 2023 15:48:50 +0300 Subject: [PATCH] Allow multipart requests to cloud storages --- cvat/apps/engine/views.py | 4 ++++ cvat/schema.yml | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index ae59914ea14f..72c595b3ba3b 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -2091,6 +2091,10 @@ class CloudStorageViewSet(viewsets.GenericViewSet, mixins.ListModelMixin, lookup_fields = {'owner': 'owner__username', 'name': 'display_name'} iam_organization_field = 'organization' + # Multipart support is necessary here, as CloudStorageWriteSerializer + # contains a file field (secret_key). + parser_classes = _UPLOAD_PARSER_CLASSES + def get_serializer_class(self): if self.request.method in ('POST', 'PATCH'): return CloudStorageWriteSerializer diff --git a/cvat/schema.yml b/cvat/schema.yml index 0664d8d8c8b5..6325ebbf0681 100644 --- a/cvat/schema.yml +++ b/cvat/schema.yml @@ -518,6 +518,9 @@ paths: manifests: - manifest.jsonl summary: Create GCS + multipart/form-data: + schema: + $ref: '#/components/schemas/CloudStorageWriteRequest' required: true security: - sessionAuth: [] @@ -647,6 +650,9 @@ paths: manifests: - manifest.jsonl summary: Create GCS + multipart/form-data: + schema: + $ref: '#/components/schemas/PatchedCloudStorageWriteRequest' security: - sessionAuth: [] csrfAuth: []