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/22 21:02:09 UTC

[airavata-django-portal] branch staging updated: AIRAVATA-3420 Return None for download url if data product doesn't exist in user storage

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

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


The following commit(s) were added to refs/heads/staging by this push:
     new 885578c  AIRAVATA-3420 Return None for download url if data product doesn't exist in user storage
885578c is described below

commit 885578ce7b12383bcda21a881b72d44914a42a9a
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jul 22 17:01:54 2021 -0400

    AIRAVATA-3420 Return None for download url if data product doesn't exist in user storage
---
 django_airavata/apps/api/serializers.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 84a4258..4ec8a53 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -466,9 +466,12 @@ class DataProductSerializer(
     filesize = serializers.SerializerMethodField()
 
     def get_downloadURL(self, data_product):
-        """Getter for downloadURL field."""
+        """Getter for downloadURL field. Returns None if file is not available."""
         request = self.context['request']
-        return user_storage.get_lazy_download_url(request, data_product)
+        if user_storage.exists(request, data_product):
+            return user_storage.get_lazy_download_url(request, data_product)
+        else:
+            return None
 
     def get_isInputFileUpload(self, data_product):
         """Return True if this is an uploaded input file."""