Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't parse GH Enterprise SSH URLs with different username #141

Closed
privatenumber opened this issue Aug 3, 2022 · 2 comments
Closed

can't parse GH Enterprise SSH URLs with different username #141

privatenumber opened this issue Aug 3, 2022 · 2 comments

Comments

@privatenumber
Copy link
Contributor

privatenumber commented Aug 3, 2022

Description

GitHub Enterprise repositories doesn't use the git username in SSH urls, and can look like this:

org-42463807@github.com:squareup/repo-name.git

When parsed, it seems to include the username in the owner, organization, full_name properties:

{
    protocols: [ 'file' ],
    protocol: 'file',
    port: '',
    resource: '',
    user: '',
    password: '',
    pathname: '',
    hash: '',
    search: '',
    href: 'org-42463807@github.com:squareup/repo-name.git',
    query: {},
    token: '',
    toString: [Function (anonymous)],
    source: '',
    git_suffix: false,
    name: 'repo-name',
    owner: 'org-42463807@github.com:squareup',
    commit: undefined,
    ref: '',
    filepathtype: '',
    filepath: '',
    organization: 'org-42463807@github.com:squareup',
    full_name: 'org-42463807@github.com:squareup/repo-name'
}

Context

This is affecting lerna's ability to publish to GitHub Enterprise repositories.

@privatenumber
Copy link
Contributor Author

privatenumber commented Aug 3, 2022

Seems like this will need to be updated to support any username:

https://github.com/IonicaBizau/parse-url/blob/155b10abe3dbb7d0277588df47bf0b2edd57a0b6/lib/index.js#L40

Based on this answer, I think this pattern should suffice: [a-z_][a-z\d_-]{0,31}

I'm happy to open a PR in parse-url, but it seems to be going through an ESM migration. Do you plan to add a CJS entry-point? Or back-port fixes to v7?

@IonicaBizau
Copy link
Owner

Sorry for the late PR reviews, and thank you for your contributions, @privatenumber! This should be fixed in 13.0.0.

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

No branches or pull requests

2 participants