Skip to content

Commit

Permalink
Allow IVO:// and BUTLER:// URI schemes to be used
Browse files Browse the repository at this point in the history
The URI scheme and netloc are meant to be case insensitive.
Since the butler URI scheme relies on butler labels which
are not case-insensitive, the netloc is not downcased in
that situation.
  • Loading branch information
timj committed Dec 5, 2024
1 parent a5155b4 commit 3cd5774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/lsst/daf/butler/_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ def parse_dataset_uri(cls, uri: str) -> tuple[str, DatasetId]:
in the ``ivo`` URI query component.
"""
parsed = urllib.parse.urlparse(uri)
if parsed.scheme == "ivo":
parsed_scheme = parsed.scheme.lower()
if parsed_scheme == "ivo":
# Do not validate the netloc or the path values.
qs = urllib.parse.parse_qs(parsed.query)
if "repo" not in qs or "id" not in qs:
Expand All @@ -577,8 +578,8 @@ def parse_dataset_uri(cls, uri: str) -> tuple[str, DatasetId]:
raise ValueError(f"Butler IVOID only supports a single value of repo and id, got {uri}")
label = qs["repo"][0]
id_ = qs["id"][0]
elif parsed.scheme == "butler":
label = parsed.netloc
elif parsed_scheme == "butler":
label = parsed.netloc # Butler label is case sensitive.
# Need to strip the leading /.
id_ = parsed.path[1:]
else:
Expand Down
3 changes: 3 additions & 0 deletions python/lsst_daf_butler.dist-info/METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Metadata-Version: 1.0
Name: lsst-daf-butler
Version: g57cedf6216+76f9c43fa5

0 comments on commit 3cd5774

Please sign in to comment.