nephila / giturlparse

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

Cannot parse `https` URLs from Radicle #59

Closed gsaslis closed 11 months ago

gsaslis commented 1 year ago

Description

giturlparse fails to parse repo URLs from Radicle

Steps to reproduce

23-05-29 6:46 ➜  repo git:(main) ✗ python
Python 3.8.1 (default, Jan 28 2021, 17:02:07)
[Clang 12.0.0 (clang-1200.0.32.21)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from giturlparse import parse
>>> p = parse('https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yorgos/.pyenv/versions/3.8.1/lib/python3.8/site-packages/giturlparse/__init__.py", line 10, in parse
    return GitUrlParsed(_parse(url, check_domain))
  File "/Users/yorgos/.pyenv/versions/3.8.1/lib/python3.8/site-packages/giturlparse/parser.py", line 53, in parse
    matches = platform.clean_data(match.groupdict(default=""))
  File "/Users/yorgos/.pyenv/versions/3.8.1/lib/python3.8/site-packages/giturlparse/platforms/base.py", line 41, in clean_data
    data["protocols"] = list(filter(lambda x: x, data["protocols"].split("+")))
KeyError: 'protocols'

Versions

23-05-29 6:47 ➜  kraken git:(main) ✗ python --version
Python 3.8.1

Expected behaviour

There seems to be an assumption that all git urls will follow the namespace/repo pattern, but, with unique repository identifiers (that radicle uses), we don't need namespace/repo any more.

Could the constraint perhaps be relaxed a little ?

Actual behaviour

described above

Additional information

I came across this issue when trying to clone git repos from https://kraken.ci/ - which uses this library.

protoroto commented 11 months ago

@gsaslis Thanks for reporting this :) could you try on latest version? I've just tried and I'm able to parse Radicle urls

>>> from giturlparse import parse
>>> p = parse("https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git")
>>> p
<giturlparse.result.GitUrlParsed object at 0x7fb603594490>
gsaslis commented 11 months ago

@protoroto thanks so much! this does work, yes! 🙌🏼

I think this can be closed.