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

Inconsistent pathname definition. #106

Open oschneidewind opened 1 month ago

oschneidewind commented 1 month ago

Description

When evaluating this package, I noticed that the pathname of an HTTPS address is output with a leading backslash, but for an SSH address without one, which means for my application that I have to check which protocol is used in order to edit the pathname if necessary.

My expectation would be that the pathname always returns the same regardless of the protocol (ideally without a leading backslash)

Steps to reproduce

The following code demonstrates the issue, the assertion is triggered, which proves the inconsistent API.

html_parse = giturlparse.parse("https://github.com/nephila/giturlparse.git")
ssh_parse = giturlparse.parse(html_parse.url2ssh)
assert ssh_parse.pathname == html_parse.pathname

Versions

Python 3.12.3

Expected behaviour

The pathname is always the same regardless of the protocol and the assertion is not triggered.

Actual behaviour

It does matter which URL is parsed, the assertion is triggered, which requires an additional processing step.

Additional information