Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#2035 Fix file upload (add IMPORT_CACHE)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Dec 17, 2024
1 parent a973442 commit 0d445b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/importers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'},
Expand Down

0 comments on commit 0d445b1

Please sign in to comment.