Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support downloading from top level /assets endpoint #723

Closed
yarikoptic opened this issue Jul 21, 2021 · 5 comments · Fixed by #748
Closed

Support downloading from top level /assets endpoint #723

yarikoptic opened this issue Jul 21, 2021 · 5 comments · Fixed by #748
Assignees

Comments

@yarikoptic
Copy link
Member

yarikoptic commented Jul 21, 2021

web-ui in the recent past switched to use top level /assets/<id>/download/ end point for download urls, from previous original one which was bound to a particular dandiset version. A quick attempt to just add a new url pattern:

diff --git a/dandi/dandiarchive.py b/dandi/dandiarchive.py
index 6d183f9..41ff4e6 100644
--- a/dandi/dandiarchive.py
+++ b/dandi/dandiarchive.py
@@ -289,6 +289,13 @@ class _dandi_url_parser:
             "https://<server>[/api]/dandisets/<dandiset id>/versions/<version>"
             "/assets/<asset id>[/download]",
         ),
+        (
+            re.compile(
+                rf"{server_grp}api/assets/(?P<asset_id>[^?/]+)/download/?"
+            ),
+            {},
+            "https://<server>/api/assets/<asset id>/download",
+        ),
         (
             re.compile(
                 rf"{server_grp}(?P<asset_type>dandiset)s/{dandiset_id_grp}"

is not sufficient since then logic "downstream" expects knowing dandiset, and also needs adjustments.

edit: example url https://api.dandiarchive.org/api/assets/2847011b-f9fb-4933-a6b5-1641e0c1886b/download/

@jwodder
Copy link
Member

jwodder commented Jul 22, 2021

@yarikoptic The download process requires the asset's metadata in order to check the digest and set the mtime, but getting the metadata requires knowing the Dandiset and version IDs, which the /assets/<id>/download/ endpoint does not provide.

@yarikoptic
Copy link
Member Author

eh heh -- filed dandi/dandi-archive#436

@yarikoptic yarikoptic added the blocked Blocked by some needed development/fix label Jul 22, 2021
@yarikoptic yarikoptic removed the blocked Blocked by some needed development/fix label Jul 30, 2021
@yarikoptic
Copy link
Member Author

removed blocked, support is implemented in dandi-api (dandi/dandi-archive#450)

@jwodder
Copy link
Member

jwodder commented Aug 2, 2021

@yarikoptic The dandi-api Docker image on Docker Hub seems to have stopped building, so the latest image does not include support for the new endpoint.

@yarikoptic
Copy link
Member Author

@yarikoptic The dandi-api Docker image on Docker Hub seems to have stopped building, so the latest image does not include support for the new endpoint.

doh -- right. I guess we need to setup github action to build/push to docker hub. https://hub.docker.com/repository/docker/dandiarchive/dandiarchive-api shows that it was updated last time 10 days ago. dandihub - 4 days ago. @satra - did you push it manually?
I remember you @satra mentioned setting up some "open source privileges" with docker for some of the repos etc. Is that something we could do for dandiarchive organization to bring back automated builds or we are doomed to build in github actions and push?

yarikoptic added a commit that referenced this issue Aug 4, 2021
Support `/asset/<asset id>/download/` URLs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants