Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions amplifier_foundation/paths/resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def parse_uri(uri: str) -> ParsedURI:
path, subpath = _extract_fragment_subpath(uri[7:])
return ParsedURI(scheme="file", host="", path=path, ref="", subpath=subpath)

# Handle Windows absolute paths
if re.match(r"^[A-Za-z]:[\\/]", uri) or uri.startswith("\\\\"):
return ParsedURI(scheme="file", host="", path=uri, ref="", subpath="")

# Handle absolute paths
if uri.startswith("/"):
return ParsedURI(scheme="file", host="", path=uri, ref="", subpath="")
Expand Down
14 changes: 14 additions & 0 deletions tests/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ def test_file_uri(self) -> None:
assert result.scheme == "file"
assert result.path == "/home/user/bundle"

def test_parse_windows_absolute_path(self) -> None:
"""Parses Windows absolute paths as file URIs."""
result = parse_uri(r"C:\Users\test\.amplifier\cache\module")
assert result.scheme == "file"
assert result.path == r"C:\Users\test\.amplifier\cache\module"
assert result.host == ""
assert result.subpath == ""

def test_parse_windows_unc_path(self) -> None:
"""Parses Windows UNC paths as file URIs."""
result = parse_uri(r"\\server\share\module")
assert result.scheme == "file"
assert result.path == r"\\server\share\module"

def test_https_uri(self) -> None:
"""Parses https:// URIs."""
result = parse_uri("https://example.com/bundle.yaml")
Expand Down
Loading