GitLab URL parsing with `git@` URLs
hutson opened this issue · comments
Hutson Betts commented
parse(`git@gitlab.com/really-long-group/with-really-long-sub-group/and-a-really-long-project-name.git`)
Returns the following results:
{ protocols: [],
protocol: 'file',
port: null,
resource: '',
user: '',
pathname: 'git@gitlab.com/really-long-group/with-really-long-sub-group/and-a-really-long-project-name.git',
hash: '',
search: '',
href: 'git@gitlab.com/really-long-group/with-really-long-sub-group/and-a-really-long-project-name.git',
query: {},
token: '',
toString: [Function],
source: '',
git_suffix: true,
name: 'and-a-really-long-project-name',
owner: 'git@gitlab.com/really-long-group/with-really-long-sub-group',
commit: undefined,
ref: '',
filepathtype: '',
filepath: '',
organization: 'git@gitlab.com/really-long-group/with-really-long-sub-group',
full_name: 'git@gitlab.com/really-long-group/with-really-long-sub-group/and-a-really-long-project-name' }
I was hoping it would return the following properties:
{
resource: 'gitlab.com',
name: `and-a-really-long-project-name`,
owner: `really-long-group/with-really-long-sub-group`
}
It pulled out the name
as desired, but not the resource
or owner
.
Ionică Bizău (Johnny B.) commented
Assuming that is an SSH url, it should be using the :
separator:
> require(".")("git@gitlab.com:really-long-group/with-really-long-sub-group/and-a-really-long-project-name.git")
{
protocols: [],
protocol: 'ssh',
port: null,
resource: 'gitlab.com',
user: 'git',
pathname: '/really-long-group/with-really-long-sub-group/and-a-really-long-project-name.git',
hash: '',
search: '',
href: 'git@gitlab.com:really-long-group/with-really-long-sub-group/and-a-really-long-project-name.git',
query: [Object: null prototype] {},
token: '',
toString: [Function],
source: 'gitlab.com',
git_suffix: true,
name: 'and-a-really-long-project-name',
owner: 'really-long-group/with-really-long-sub-group',
commit: undefined,
ref: '',
filepathtype: '',
filepath: '',
organization: 'really-long-group/with-really-long-sub-group',
full_name: 'really-long-group/with-really-long-sub-group/and-a-really-long-project-name'
}
Hutson Betts commented
@IonicaBizau, yes, that was a pretty big oversight on my part. The URL is not a valid URL that can be passed to Git.