Skip to content

URI handler rejects PR URLs with underscores in owner name #8758

Description

@muiriswoulfe
  • Extension version: 0.146.0
  • VSCode Version: latest stable
  • OS: Windows 11
  • Repository Clone Configuration: n/a (URI handler invocation, no repo cloned)
  • GitHub Product: GitHub.com

The URI handlers /open-pull-request-changes, /checkout-pull-request, and /open-pull-request-webview reject GitHub PR URLs whose owner contains an underscore. Enterprise Managed User (EMU) accounts on github.com receive a _company suffix and therefore contain underscores, so PRs in repositories owned by such accounts cannot be opened via the URI handler.

Steps to Reproduce:

  1. Paste into the address bar: vscode://GitHub.vscode-pull-request-github/open-pull-request-changes?uri=https://github.com/some_owner/some-repo/pull/1 (any PR whose owner contains _ will do).
  2. Observe the notification "Invalid pull request URI." The equivalent URL from the v0.126.0 changelog (uri=https://github.com/microsoft/vscode-css-languageservice/pull/460) works.

Root cause: validateOpenWebviewParams in src/common/uri.ts validates the owner against ownerRegex = /^(?!-)(?!.*--)[a-zA-Z0-9-]+(?<!-)$/, which excludes _. The companion repoRegex (/^[a-zA-Z0-9_.-]+$/) does allow _, so the two rules are inconsistent.

Fix: relax ownerRegex to allow _, e.g. /^(?!-)(?!.*--)[a-zA-Z0-9_-]+(?<!-)$/.

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions