Skip to content

Fix domain components for second-level domains in RDAP#111

Merged
pogzyb merged 1 commit into
pogzyb:mainfrom
nazywam:bugfix/domain-components
Oct 31, 2025
Merged

Fix domain components for second-level domains in RDAP#111
pogzyb merged 1 commit into
pogzyb:mainfrom
nazywam:bugfix/domain-components

Conversation

@nazywam
Copy link
Copy Markdown
Contributor

@nazywam nazywam commented Oct 30, 2025

Hey, It's me again 😅

I think the current implementation of _get_domain_components might be broken for second-level domains.

For example, given the domain: impots.gouv.fr it will output:

print(client._get_domain_components("impots.gouv.fr"))'
('impots.gouv.fr', 'impots', 'fr')

As a result, whodap will be launched with: self.whodap_client.lookup("impots", "fr") and will, de facto, perform a query for impots.fr instead of impots.gouv.fr.

I think removing the TLD suffix for domain cores should work but let me know if you'd rather resolve this differently.

Copy link
Copy Markdown
Owner

@pogzyb pogzyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome back 😅!

I tested your changes and your logic is definitely what was originally intended. I think the use of .removesuffix and domain_core is perfectly fine -- I can't think of any edge cases where this would fail.

Thanks again for your expertise and contributions 🫡

@pogzyb pogzyb merged commit 6b9c934 into pogzyb:main Oct 31, 2025
12 checks passed
@pogzyb pogzyb mentioned this pull request Oct 31, 2025
@nazywam nazywam deleted the bugfix/domain-components branch October 31, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants