whoisit icon indicating copy to clipboard operation
whoisit copied to clipboard

follow_related should also filter for rdap+json entries

Open glefait opened this issue 2 months ago • 0 comments

When follow_related=True additionnal related or registration links are searched even if their type is not rdap+json. This may lead to an exception.

However, those links may also contained non JSON endpoint.

For example, the entry https://rdap.centralnic.com/tech/domain/recrut.tech has the following results


    "links": [
        {
            "title": "Authoritative URL for this resource",
            "rel": "self",
            "type": "application\/rdap+json",
            "value": "https://rdap.centralnic.com/tech/domain/recrut.tech",
            "href": "https://rdap.centralnic.com/tech/domain/recrut.tech"
        },
        {
            "title": "RDAP Service Help",
            "rel": "help",
            "type": "text\/html",
            "value": "https://rdap.centralnic.com/tech/domain/recrut.tech",
            "href": "https://whois.nic.tech/rdap"
        },
        {
            "title": "Dot Tech LLC",
            "rel": "related",
            "type": "text\/html",
            "value": "https://rdap.centralnic.com/tech/domain/recrut.tech",
            "href": "http://radixregistry.com"
        },

The third entry (Dot Tech LLC) has "rel": "related" however it's type is "type": "text/html"

Consequently, running the following is fine:

whoisit.domain('recrut.tech', follow_related=False)

but when follow_related=True this leads to

    raise QueryError(f'Failed to parse RDAP Query response as JSON: {e}', response=error_content) from e
whoisit.errors.QueryError: Failed to parse RDAP Query response as JSON: Expecting value: line 1 column 1 (char 0)

A fix should be to add a condition in the following code to test if the type is application/rdap+json https://github.com/meeb/whoisit/blob/7445e0e398d0522ebb858cfe952d1ac2e5edefbc/whoisit/init.py#L79-L81

If it makes sense, I can make the PR.

glefait avatar Nov 04 '25 19:11 glefait