Skip to content

Commit

Permalink
Merge pull request #8 from aoxolotl/fixDownload
Browse files Browse the repository at this point in the history
Fix download file name error in client.py
  • Loading branch information
ninthreezy authored Aug 2, 2023
2 parents cde491a + 891f300 commit f4d375a
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 f4d375a

Please sign in to comment.