Skip to content

Commit

Permalink
Fix download file name error in client.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aoxolotl authored Aug 1, 2023
1 parent cde491a commit 891f300
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions datatorch/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 891f300

Please sign in to comment.