Skip to content

Support downloading from top level /assets endpoint #723

Closed
@yarikoptic

Description

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/

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions