Skip to content

Commit f4d375a

Browse files
authored
Merge pull request #8 from aoxolotl/fixDownload
Fix download file name error in client.py
2 parents cde491a + 891f300 commit f4d375a

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

datatorch/api/client.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,20 @@ def download_file(
152152
skip: bool = True
153153
# For now, skip does nothing
154154
):
155-
# If it exists and skip is true, do not download
156-
name = os.path.join(directory, name)
157-
name = os.path.abspath(name)
158-
159-
if os.path.isfile(name) & skip == True:
160-
return name, None
155+
## If it exists and skip is true, do not download
156+
# name = os.path.join(directory, name)
157+
# name = os.path.abspath(name)
158+
# This name overwrites the value into name
159+
# Causes a problem on line 175 if name is expected to be empty
160+
# On first run of download file name is supposed to ''
161+
# Loaded as default value from action-datatorch.yaml
162+
# But on subsequent runs if file exists, name is not empty
163+
# Temporary fix here
164+
dl_file = os.path.join(directory, name)
165+
dl_file = os.path.abspath(dl_file)
166+
167+
if os.path.isfile(dl_file) & skip == True:
168+
return dl_file, None
161169

162170
query_string = urlencode({"download": "true", "stream": "true"})
163171
url = normalize_api_url(self.api_url)

0 commit comments

Comments
 (0)