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/06 18:38:24 UTC

[airavata-django-portal-sdk] branch master updated: AIRAVATA-3431 Copy fix to the SDK download_file view

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


The following commit(s) were added to refs/heads/master by this push:
     new b33bcf0  AIRAVATA-3431 Copy fix to the SDK download_file view
b33bcf0 is described below

commit b33bcf0dac8872f12a31580d41962e7ade1fb007
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jul 6 14:38:11 2021 -0400

    AIRAVATA-3431 Copy fix to the SDK download_file view
---
 airavata_django_portal_sdk/views.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/airavata_django_portal_sdk/views.py b/airavata_django_portal_sdk/views.py
index 498402f..884fb13 100644
--- a/airavata_django_portal_sdk/views.py
+++ b/airavata_django_portal_sdk/views.py
@@ -51,7 +51,10 @@ def download_file(request):
     try:
         data_file = user_storage.open_file(request, data_product)
         response = FileResponse(data_file, content_type=mime_type)
-        file_name = os.path.basename(data_file.name)
+        if user_storage.is_input_file(request, data_product):
+            file_name = data_product.productName
+        else:
+            file_name = os.path.basename(data_file.name)
         if mime_type == 'application/octet-stream' or force_download:
             response['Content-Disposition'] = ('attachment; filename="{}"'
                                                .format(file_name))