giturlparse icon indicating copy to clipboard operation
giturlparse copied to clipboard

Inconsistent pathname definition.

Open oschneidewind opened this issue 1 year ago • 2 comments

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

oschneidewind avatar Jun 16 '24 18:06 oschneidewind