- 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:
- 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).
- 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_-]+(?<!-)$/.
The URI handlers
/open-pull-request-changes,/checkout-pull-request, and/open-pull-request-webviewreject GitHub PR URLs whose owner contains an underscore. Enterprise Managed User (EMU) accounts on github.com receive a_companysuffix and therefore contain underscores, so PRs in repositories owned by such accounts cannot be opened via the URI handler.Steps to Reproduce:
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).uri=https://github.com/microsoft/vscode-css-languageservice/pull/460) works.Root cause:
validateOpenWebviewParamsinsrc/common/uri.tsvalidates the owner againstownerRegex = /^(?!-)(?!.*--)[a-zA-Z0-9-]+(?<!-)$/, which excludes_. The companionrepoRegex(/^[a-zA-Z0-9_.-]+$/) does allow_, so the two rules are inconsistent.Fix: relax
ownerRegexto allow_, e.g./^(?!-)(?!.*--)[a-zA-Z0-9_-]+(?<!-)$/.