From 0d445b1fc09fe920e0833592907a79a5a0a5652e Mon Sep 17 00:00:00 2001 From: rkorytkowski Date: Tue, 17 Dec 2024 11:37:06 +0100 Subject: [PATCH] OpenConceptLab/ocl_issues#2035 Fix file upload (add IMPORT_CACHE) --- core/importers/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/importers/views.py b/core/importers/views.py index cdd72e09..b47df4f8 100644 --- a/core/importers/views.py +++ b/core/importers/views.py @@ -27,6 +27,7 @@ from core.common.utils import queue_bulk_import, is_csv_file, get_truthy_values, get_queue_task_names, \ get_export_service from core.importers.constants import ALREADY_QUEUED, INVALID_UPDATE_IF_EXISTS, NO_CONTENT_TO_IMPORT +from core.importers.importer import Importer from core.importers.input_parsers import ImportContentParser from core.tasks.models import Task from core.tasks.serializers import TaskDetailSerializer, TaskListSerializer @@ -197,6 +198,8 @@ def post(self, request, import_queue=None): with open(file_url, 'wb') as f: shutil.copyfileobj(file, f) else: + if not key.startswith(Importer.IMPORT_CACHE): + key = Importer.IMPORT_CACHE + key upload_service = get_export_service() upload_service.upload(key, file, metadata={'ContentType': 'application/octet-stream'},