nephila / giturlparse

Parse & rewrite git urls (supports GitHub, Bitbucket, Assembla ...)
https://pypi.python.org/pypi/giturlparse
Apache License 2.0
31 stars 22 forks source link

Can't parse git urls that start with "ssh://" #44

Closed yyugh closed 1 year ago

yyugh commented 2 years ago

Description

Both urls are valid, but the one that starts with "ssh://" can't be parsed.

>>> import giturlparse
>>> p=giturlparse.parse("git@gitlab.example.com:groupA/projectB.git")
>>> vars(p)
{'_parsed': defaultdict(<function parse.<locals>.<lambda> at 0x105291700>, {'port': '', 'path_raw': '', 'groups_path': '', '_user': 'git', 'protocols': [], 'protocol': 'ssh', 'domain': 'gitlab.example.com', 'pathname': 'groupA/projectB.git', 'owner': 'groupA', 'repo': 'projectB', 'path': '', 'branch': '', 'url': 'git@gitlab.example.com:groupA/projectB.git', 'platform': 'gitlab'}), 'port': '', 'path_raw': '', 'groups_path': '', '_user': 'git', 'protocols': [], 'protocol': 'ssh', 'domain': 'gitlab.example.com', 'pathname': 'groupA/projectB.git', 'owner': 'groupA', 'repo': 'projectB', 'path': '', 'branch': '', 'url': 'git@gitlab.example.com:groupA/projectB.git', 'platform': 'gitlab', '_platform_obj': <giturlparse.platforms.gitlab.GitLabPlatform object at 0x1052a9640>}
>>> p1=giturlparse.parse("ssh://git@gitlab.example.com/groupA/projectB.git")
>>> vars(p1)
{'_parsed': defaultdict(<function parse.<locals>.<lambda> at 0x10533e820>, {'port': '', 'path_raw': '', 'groups_path': ''}), 'port': '', 'path_raw': '', 'groups_path': ''}

Steps to reproduce

Versions

0.10.0

Expected behaviour

Actual behaviour

Additional information

yakky commented 1 year ago

Fix by #52, thanks for reporting this