From 8cc32a5b2108ccc871af601cda913036a84c5388 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 07:06:09 +0000 Subject: [PATCH 1/4] Initial plan From 51af71f988fcd74d3097f278b4a1fb3bfb373efb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 07:16:51 +0000 Subject: [PATCH 2/4] fix: detect Windows absolute paths (drive letters) as local paths in reference.py Co-authored-by: danielmeppiel <51440732+danielmeppiel@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/apm/sessions/9f97de46-d7db-4624-8633-30fdefbcf106 --- src/apm_cli/models/dependency/reference.py | 10 ++++++++-- tests/unit/test_local_deps.py | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/apm_cli/models/dependency/reference.py b/src/apm_cli/models/dependency/reference.py index 55207a9e..6427b41f 100644 --- a/src/apm_cli/models/dependency/reference.py +++ b/src/apm_cli/models/dependency/reference.py @@ -129,14 +129,20 @@ def get_virtual_package_name(self) -> str: def is_local_path(dep_str: str) -> bool: """Check if a dependency string looks like a local filesystem path. - Local paths start with './', '../', '/', or '~'. + Local paths start with './', '../', '/', '~', or a Windows drive + letter (e.g. 'C:\\' or 'C:/'). Protocol-relative URLs ('//...') are explicitly excluded. """ s = dep_str.strip() # Reject protocol-relative URLs ('//...') if s.startswith('//'): return False - return s.startswith(('./','../', '/', '~/', '~\\', '.\\', '..\\')) + if s.startswith(('./','../', '/', '~/', '~\\', '.\\', '..\\')): + return True + # Windows absolute paths: drive letter + colon + separator (C:\ or C:/) + if len(s) >= 3 and s[0].isalpha() and s[1] == ':' and s[2] in ('\\', '/'): + return True + return False def get_unique_key(self) -> str: """Get a unique key for this dependency for deduplication. diff --git a/tests/unit/test_local_deps.py b/tests/unit/test_local_deps.py index 64491adb..323d2300 100644 --- a/tests/unit/test_local_deps.py +++ b/tests/unit/test_local_deps.py @@ -37,6 +37,18 @@ def test_windows_parent(self): def test_windows_home(self): assert DependencyReference.is_local_path("~\\repos\\my-pkg") is True + def test_windows_absolute_backslash(self): + assert DependencyReference.is_local_path("C:\\Users\\runner\\my-pkg") is True + + def test_windows_absolute_forward_slash(self): + assert DependencyReference.is_local_path("D:/repos/my-pkg") is True + + def test_windows_absolute_uppercase(self): + assert DependencyReference.is_local_path("Z:\\some\\path") is True + + def test_windows_absolute_lowercase(self): + assert DependencyReference.is_local_path("c:\\users\\me\\pkg") is True + def test_remote_shorthand_not_local(self): assert DependencyReference.is_local_path("owner/repo") is False From 88806a481a7204783c441062b2fb75d197aee5bd Mon Sep 17 00:00:00 2001 From: Daniel Meppiel <51440732+danielmeppiel@users.noreply.github.com> Date: Tue, 24 Mar 2026 09:06:00 +0100 Subject: [PATCH 3/4] Update reference.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/apm_cli/models/dependency/reference.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/apm_cli/models/dependency/reference.py b/src/apm_cli/models/dependency/reference.py index 6427b41f..0aafbfcc 100644 --- a/src/apm_cli/models/dependency/reference.py +++ b/src/apm_cli/models/dependency/reference.py @@ -139,8 +139,14 @@ def is_local_path(dep_str: str) -> bool: return False if s.startswith(('./','../', '/', '~/', '~\\', '.\\', '..\\')): return True - # Windows absolute paths: drive letter + colon + separator (C:\ or C:/) - if len(s) >= 3 and s[0].isalpha() and s[1] == ':' and s[2] in ('\\', '/'): + # Windows absolute paths: drive letter + colon + separator (C:\ or C:/). + # Only ASCII letters A-Z/a-z are valid drive letters. + if ( + len(s) >= 3 + and (('A' <= s[0] <= 'Z') or ('a' <= s[0] <= 'z')) + and s[1] == ':' + and s[2] in ('\\', '/') + ): return True return False From 063a58fb70c75dc4a993e7ceb26dfbc92c4e3a46 Mon Sep 17 00:00:00 2001 From: Daniel Meppiel <51440732+danielmeppiel@users.noreply.github.com> Date: Tue, 24 Mar 2026 09:06:23 +0100 Subject: [PATCH 4/4] Update reference.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/apm_cli/models/dependency/reference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apm_cli/models/dependency/reference.py b/src/apm_cli/models/dependency/reference.py index 0aafbfcc..84a99202 100644 --- a/src/apm_cli/models/dependency/reference.py +++ b/src/apm_cli/models/dependency/reference.py @@ -129,7 +129,7 @@ def get_virtual_package_name(self) -> str: def is_local_path(dep_str: str) -> bool: """Check if a dependency string looks like a local filesystem path. - Local paths start with './', '../', '/', '~', or a Windows drive + Local paths start with './', '../', '/', '~/', '~\\', or a Windows drive letter (e.g. 'C:\\' or 'C:/'). Protocol-relative URLs ('//...') are explicitly excluded. """