Skip to content

Commit 9655d10

Browse files
authored
Merge pull request #537 from dandi/most-recent-published-version
Update dandiarchive client to use most_recent_published_version
2 parents 72992d9 + ae8d94d commit 9655d10

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dandi/dandiarchive.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ def navigate_url(url):
4848
client = DandiAPIClient(server_url)
4949
if asset_id["version"] is None:
5050
r = client.get(f"/dandisets/{asset_id['dandiset_id']}/")
51-
asset_id["version"] = r["most_recent_version"]["version"]
51+
if "draft_version" in r:
52+
asset_id["version"] = r["draft_version"]["version"]
53+
published_version = r["most_recent_published_version"]
54+
if published_version:
55+
asset_id["version"] = published_version["version"]
56+
else:
57+
# TODO: remove `if` after https://github.com/dandi/dandi-api/pull/219
58+
# is merged/deployed
59+
asset_id["version"] = r["most_recent_version"]["version"]
5260
args = (asset_id["dandiset_id"], asset_id["version"])
5361
kwargs["include_metadata"] = True
5462
if asset_id.get("location") or asset_id.get("asset_id"):

0 commit comments

Comments
 (0)