diff --git a/src/uproot/_util.py b/src/uproot/_util.py index 3196bda76..9e73cb7b4 100644 --- a/src/uproot/_util.py +++ b/src/uproot/_util.py @@ -313,11 +313,11 @@ def file_object_path_split(urlpath: str) -> tuple[str, str | None]: separator = "::" parts = urlpath.split(separator) - object_regex = re.compile(r"(.+\.root):(.*$)", re.IGNORECASE) + object_regex = re.compile(r"(.+\.root(\.[0-9]+)?):(.*$)", re.IGNORECASE) for i, part in enumerate(reversed(parts)): match = object_regex.match(part) if match: - obj = re.sub(r"/+", "/", match.group(2).strip().lstrip("/")).rstrip("/") + obj = re.sub(r"/+", "/", match.group(3).strip().lstrip("/")).rstrip("/") parts[-i - 1] = match.group(1) break diff --git a/tests/test_0976_path_object_split.py b/tests/test_0976_path_object_split.py index a5617fa18..28830478d 100644 --- a/tests/test_0976_path_object_split.py +++ b/tests/test_0976_path_object_split.py @@ -163,6 +163,13 @@ "Dir/Test", ), ), + ( + "http://xcacheserver:8762//https://originserver:4212/path/file.root.1:CollectionTree", + ( + "http://xcacheserver:8762//https://originserver:4212/path/file.root.1", + "CollectionTree", + ), + ), ], ) def test_url_split(input_value, expected_output): @@ -202,7 +209,6 @@ def test_url_no_split(input_value): "local/file.root.zip://Events", "local/file.roo://Events", "local/file://Events", - "http://xcacheserver:8762//https://originserver:4212/path/file.root.1:CollectionTree", ], ) def test_url_split_invalid(input_value):