Closed Bixilon closed 3 months ago
I have no clue what the library is doing, but it should cut off the first part of a domain (test.abc.de
-> abc.de
). The library just does it with the top level domain (test.abc.de
-> de
, but not even then correct, check a domain with a dash test.ab-cd.de
, it then just returns nothing).
It is used in a header (nginx), and if that header is not set correctly, things like chart loading fail.
Tested it, working fine!
Any chance of getting this merged?
Testing with tldextract-5.1.2
:
In [9]: print(tldextract.extract('openwisp.org').registered_domain)
openwisp.org
In [10]: print(tldextract.extract('api.openwisp.org').registered_domain)
openwisp.org
In [11]: print(tldextract.extract('test.api.openwisp.org').registered_domain)
openwisp.org
In [12]: print(tldextract.extract('test.abc.de').registered_domain)
abc.de
In [13]: print(tldextract.extract('abc.de').registered_domain)
abc.de
In [14]: print(tldextract.extract('test.test.abc.de').registered_domain)
abc.de
I cannot replicate the issue you are mentioning here. I will try to update this library and modify the different parts of the code to make sure they're consistent.
try extracting from api.open-wisp.de
try extracting from api.open-wisp.de
~As far as I know, dashes are not allowed in the domain.~ Yes they are allowed.
try extracting from api.open-wisp.de
In [1]: import tldextract
In [2]: ext=tldextract.extract('api.open-wisp.org')
In [3]: ext
Out[3]: ExtractResult(subdomain='api', domain='open-wisp', suffix='org', is_private=False)
In [4]: ext.registered_domain
Out[4]: 'open-wisp.org'
What's the issue? Please update your local copy of the library. PR in https://github.com/openwisp/docker-openwisp/pull/300.
Should fix #273, not tested