You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/07/29 15:41:11 UTC

[airavata-django-portal-sdk] 01/03: Pass name of file in remote API call when saving file

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal-sdk.git

commit 5087097fc683b4453cf9a7e8189a7179f9f7ba5d
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jul 29 11:34:48 2021 -0400

    Pass name of file in remote API call when saving file
---
 airavata_django_portal_sdk/user_storage/api.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/airavata_django_portal_sdk/user_storage/api.py b/airavata_django_portal_sdk/user_storage/api.py
index c226e08..413506e 100644
--- a/airavata_django_portal_sdk/user_storage/api.py
+++ b/airavata_django_portal_sdk/user_storage/api.py
@@ -80,7 +80,7 @@ def save(request, path, file, name=None, content_type=None, storage_resource_id=
         if name is None and hasattr(file, 'name'):
             name = os.path.basename(file.name)
         files = {'file': (name, file, content_type)
-                 if content_type is not None else file, }
+                 if content_type is not None else (name, file)}
         resp = _call_remote_api(request,
                                 "/user-storage/~/{path}",
                                 path_params={"path": path},
@@ -107,7 +107,7 @@ def save_input_file(request, file, name=None, content_type=None, storage_resourc
         if name is None and hasattr(file, 'name'):
             name = os.path.basename(file.name)
         files = {'file': (name, file, content_type)
-                 if content_type is not None else file, }
+                 if content_type is not None else (name, file)}
         resp = _call_remote_api(request,
                                 "/upload",
                                 method="post",