Skip to content

urlparse does not correctly parse Git SSH URLs. #349

@axiomcura

Description

@axiomcura

Currently, the Almanack relies on Python’s built-in urlparse to parse GitHub SSH links

parsed_url = urlparse(remote_url)
if parsed_url.scheme in {"http", "https", "ssh"} and parsed_url.netloc:
return remote_url

Below is an example of using the code if a remote link is provided (SHH format)

Image

urlparse does not properly handle SSH-style GitHub URLs (e.g., git@github.com:user/repo.git), since these URLs do not include a scheme. As a result, the parsing step fails and the function always returns None when the rest of the code expects a valid scheme to extract the repository URL.

Proposed solution:
Use giturlparse, which may correctly parse both HTTPS and SSH Git URLs. This would ensure consistent parsing across different remote URL formats.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions