Skip to content

Commit 2460935

Browse files
committed
Preserve URL parse parameters when recursing
1 parent 9007788 commit 2460935

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

dandi/dandiarchive.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -694,12 +694,12 @@ def parse(
694694
assert not handle_redirect
695695
assert not settings.get("map_instance")
696696
new_url = rewrite(url)
697-
return cls.parse(new_url)
697+
return cls.parse(new_url, map_instance=map_instance, glob=glob)
698698
elif handle_redirect:
699699
assert handle_redirect in ("pass", "only")
700700
new_url = cls.follow_redirect(url)
701701
if new_url != url:
702-
return cls.parse(new_url)
702+
return cls.parse(new_url, map_instance=map_instance, glob=glob)
703703
if handle_redirect == "pass":
704704
# We used to issue warning in such cases, but may be it got implemented
705705
# now via reverse proxy and we had added a new regex? let's just
@@ -712,7 +712,7 @@ def parse(
712712
)
713713
elif settings.get("map_instance"):
714714
if map_instance:
715-
parsed_url = cls.parse(url, map_instance=False)
715+
parsed_url = cls.parse(url, map_instance=False, glob=glob)
716716
if settings["map_instance"] not in known_instances:
717717
raise ValueError(
718718
"Unknown instance {}. Known are: {}".format(

dandi/tests/test_dandiarchive.py

+10
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,16 @@ def test_parse_api_url(url: str, parsed_url: ParsedDandiURL) -> None:
361361
@pytest.mark.parametrize(
362362
"url,parsed_url",
363363
[
364+
(
365+
"https://dandiarchive.org/dandiset/001001/draft/files"
366+
"?location=sub-RAT123/*.nwb",
367+
AssetGlobURL(
368+
instance=known_instances["dandi"],
369+
dandiset_id="001001",
370+
version_id="draft",
371+
path="sub-RAT123/*.nwb",
372+
),
373+
),
364374
pytest.param(
365375
"https://gui.dandiarchive.org/#/dandiset/001001/draft/files"
366376
"?location=sub-RAT123/*.nwb",

0 commit comments

Comments
 (0)