diff --git a/fiona/_path.py b/fiona/_path.py index 8d511a73..f25842f9 100644 --- a/fiona/_path.py +++ b/fiona/_path.py @@ -66,8 +66,8 @@ class _ParsedPath(_Path): @classmethod def from_uri(cls, uri): parts = urlparse(uri) - if sys.platform == "win32" and re.match(r"^[a-zA-Z]\:", parts.netloc) and not parts.path: - parsed_path = parts.netloc + if sys.platform == "win32" and re.match(r"^[a-zA-Z]\:", parts.netloc): + parsed_path = f"{parts.netloc}{parts.path}" parsed_netloc = None else: parsed_path = parts.path diff --git a/tests/test__path.py b/tests/test__path.py index 68d4f267..8c60eaea 100644 --- a/tests/test__path.py +++ b/tests/test__path.py @@ -13,3 +13,12 @@ def test_parse_zip_windows(monkeypatch): vsi_path = _vsi_path(path) assert vsi_path.startswith("/vsizip/D") assert vsi_path.endswith("coutwildrnp.zip/coutwildrnp.shp") + + +def test_parse_zip_windows(monkeypatch): + """Parse a tar+ Windows path.""" + monkeypatch.setattr(sys, "platform", "win32") + path = _parse_path("tar://D:\\a\\Fiona\\Fiona\\tests\\data\\coutwildrnp.tar!testing/coutwildrnp.shp") + vsi_path = _vsi_path(path) + assert vsi_path.startswith("/vsitar/D") + assert vsi_path.endswith("coutwildrnp.tar/testing/coutwildrnp.shp")