Skip to content

Commit

Permalink
"Hardcode" the knowledge that location= option in URL can only point …
Browse files Browse the repository at this point in the history
…to the folder

Per @AlmightyYakob observation in
dandi/dandi-archive#1546 (comment)
  • Loading branch information
yarikoptic committed Jun 15, 2023
1 parent 614ec27 commit b28a43b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dandi/dandiarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class _dandi_url_parser:
re.compile(
rf"{server_grp}(#/)?(?P<asset_type>dandiset)/{dandiset_id_grp}"
rf"(/(?P<version>{VERSION_REGEX}))?"
r"(/(files(\?location=(?P<location>.*)?)?)?)?"
r"(/(files(\?location=(?P<location-folder>.*)?)?)?)?"
),
{},
"https://<server>[/api]/[#/]dandiset/<dandiset id>[/<version>]"
Expand Down Expand Up @@ -760,7 +760,13 @@ def parse(
# asset_type = groups.get("asset_type")
dandiset_id = groups.get("dandiset_id")
version_id = groups.get("version")
location = groups.get("location")
if "location-folder" in groups:
assert "location" not in groups
location = groups.get("location-folder")
if not location.endswith("/"):
location += "/"
else:
location = groups.get("location")
asset_id = groups.get("asset_id")
path = groups.get("path")
glob_param = groups.get("glob")
Expand Down

0 comments on commit b28a43b

Please sign in to comment.