Skip to content
Merged
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: 3 additions & 1 deletion src/apm_cli/utils/github_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def is_valid_fqdn(hostname: str) -> bool:
"""
if not hostname:
return False


hostname = hostname.split('/')[0] # Remove any path components
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fix solves the immediate issue, the function's name and docstring don't accurately reflect that it now accepts and strips path components. The docstring says "Validate if a string is a valid Fully Qualified Domain Name (FQDN)" but an FQDN by definition shouldn't contain paths.

Consider adding a comment here explaining why path stripping is needed (e.g., "// Strip path components to support package references like 'github.com/user/repo'") or update the function's docstring to document this behavior.

Copilot uses AI. Check for mistakes.

# Single regex to validate all FQDN rules:
# - Starts with alphanumeric
# - Labels only contain alphanumeric and hyphens
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_github_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
def test_valid_fqdns():
valid_hosts = [
"github.com",
"github.com/user/repo",
"example.com",
"sub.example.co.uk",
"a1b2.example",
Expand Down
Loading