Skip to content

Commit

Permalink
Only rely on the file ID, not PID
Browse files Browse the repository at this point in the history
  • Loading branch information
leouieda committed Feb 19, 2024
1 parent 93d9835 commit 15f7536
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions pooch/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,19 +1134,11 @@ def download_url(self, file_name):
f"File '{file_name}' not found in data archive "
f"{self.archive_url} (doi:{self.doi})."
)
# Generate download_url using persistentId or file id
persistent_id = files[file_name].get("persistentId")
if persistent_id:
download_url = (
f"{parsed['protocol']}://{parsed['netloc']}/api/access/datafile/"
f":persistentId?persistentId={persistent_id}"
)
else:
file_id = files[file_name]["id"]
download_url = (
f"{parsed['protocol']}://{parsed['netloc']}/api/access/datafile/"
f"{file_id}"
)
# Generate download_url using the file id
download_url = (
f"{parsed['protocol']}://{parsed['netloc']}/api/access/datafile/"
f"{files[file_name]['id']}"
)
return download_url

def populate_registry(self, pooch):
Expand Down

0 comments on commit 15f7536

Please sign in to comment.