Skip to content

fix: support spaces in Azure DevOps project names#92

Open
ryanfk wants to merge 1 commit intomicrosoft:mainfrom
ryanfk:fix/ado-project-names-with-spaces
Open

fix: support spaces in Azure DevOps project names#92
ryanfk wants to merge 1 commit intomicrosoft:mainfrom
ryanfk:fix/ado-project-names-with-spaces

Conversation

@ryanfk
Copy link

@ryanfk ryanfk commented Feb 19, 2026

Summary

  • Azure DevOps project names can contain spaces (e.g., Americas Praxair tfs), but apm install rejected them with "not accessible or doesn't exist"
  • The character-validation regexes in DependencyReference.parse() only allowed [a-zA-Z0-9._-], blocking spaces and %20-encoded input
  • URL builder functions (build_ado_https_clone_url, build_ado_ssh_url, build_ado_api_url) interpolated project names directly without percent-encoding

Changes

src/apm_cli/models/apm_package.py:

  • Decode percent-encoded input (%20 → space) early in parse()
  • Allow spaces in ADO path-component validation regexes
  • Decode percent-encoded path components after URL parsing
  • URL-encode project segment in to_github_url()

src/apm_cli/utils/github_host.py:

  • URL-encode the project parameter in build_ado_https_clone_url(), build_ado_ssh_url(), and build_ado_api_url()

All three input forms now work

apm install dev.azure.com/org/My%20Project/repo
apm install "dev.azure.com/org/My Project/repo"
apm install dev.azure.com/org/My%20Project/_git/repo

Test plan

  • All 99 existing tests pass — confirms no regressions for project names without spaces
  • Verified parsing with %20, literal spaces, and _git segment
  • Verified URL builders produce correctly encoded URLs

Fixes #89

🤖 Generated with Claude Code

ADO project names may contain spaces (e.g., "Americas Praxair tfs").
Previously, `apm install` rejected these with "not accessible or
doesn't exist" because the character-validation regexes only allowed
`[a-zA-Z0-9._-]`.

Changes:
- Decode percent-encoded input (`%20`) early in DependencyReference.parse()
- Allow spaces in ADO path-component validation regexes
- URL-encode the project segment when building HTTPS clone, SSH, and
  REST API URLs via build_ado_* helpers and to_github_url()

All three input forms now work:
  apm install dev.azure.com/org/My%20Project/repo
  apm install dev.azure.com/org/My Project/repo
  apm install dev.azure.com/org/My%20Project/_git/repo

Fixes microsoft#89

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] apm install fails for Azure DevOps projects with spaces in the project name

1 participant

Comments