diff --git a/datatorch/api/client.py b/datatorch/api/client.py index c7ff371..0428901 100644 --- a/datatorch/api/client.py +++ b/datatorch/api/client.py @@ -152,12 +152,20 @@ def download_file( skip: bool = True # For now, skip does nothing ): - # If it exists and skip is true, do not download - name = os.path.join(directory, name) - name = os.path.abspath(name) - - if os.path.isfile(name) & skip == True: - return name, None + ## If it exists and skip is true, do not download + # name = os.path.join(directory, name) + # name = os.path.abspath(name) + # This name overwrites the value into name + # Causes a problem on line 175 if name is expected to be empty + # On first run of download file name is supposed to '' + # Loaded as default value from action-datatorch.yaml + # But on subsequent runs if file exists, name is not empty + # Temporary fix here + dl_file = os.path.join(directory, name) + dl_file = os.path.abspath(dl_file) + + if os.path.isfile(dl_file) & skip == True: + return dl_file, None query_string = urlencode({"download": "true", "stream": "true"}) url = normalize_api_url(self.api_url)