Skip to content

Relative links confuse PyPi #129

@bennati

Description

@bennati

When attempting to fetch package versions, python inspector might crash with the following error:

Error: Unsupported URL scheme: ../../XYZ/0.0.1/XYZ-0.0.1.tar.gz

This is caused by python-inspector not interpreting correctly relative links, for example as defined in the following HTML:

<!DOCTYPE html>
<html><head><title>Simple Index</title><meta name="api-version" value="2" /></head><body>
<a href="../../XYZ/0.0.1/XYZ-0.0.1.tar.gz#sha256=12345" rel="internal">XYZ-0.0.1.tar.gz</a><br />
</body></html>

Python-inspector reads tags https://github.com/nexB/python-inspector/blob/8b0790020dcfa8cdbd647ff2f63f3ce53c169e37/src/python_inspector/utils_pypi.py#L1591 but does not check if these are complete URLs or relative links.
Any relative link should be converted into an absolute one by prepending the URL of the HTML source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions