Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emark's DOMAIN is not working correctly with naked domains (no www) #97

Closed
amureki opened this issue Aug 22, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@amureki
Copy link
Member

amureki commented Aug 22, 2024

Depending on if we are using naked or non-naked domain, the following piece acts differently:

emark/emark/message.py

Lines 119 to 121 in a844123

top_level_domain = ".".join(site_url.split(".")[-2:])
if not redirect_url_parts.netloc.endswith(top_level_domain):
return redirect_url

So, when I have www.example.com as EMARK["DOMAIN"], top_level_domain is example.com

However, when I use example.com as EMARK["DOMAIN"], top_level_domain becomes https://example.com

That means, the tracking logic is always ignored, as redirect_url_parts.netloc.endswith(top_level_domain) is always False

@amureki amureki added the bug Something isn't working label Aug 22, 2024
@amureki
Copy link
Member Author

amureki commented Aug 22, 2024

It might be a good idea to introduce a dedicated library that handles all variety of domains, for example:
https://github.com/john-kurkowski/tldextract/

@codingjoe
Copy link
Member

It might be a good idea to introduce a dedicated library that handles all variety of domains, for example:
https://github.com/john-kurkowski/tldextract/

Hm... might be risky to introduce a dependency with potential vulnerabilities, for that can be solved in a single regular expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants