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

Weird behaviour on Github.io getDomain #93

Closed
ahmadassaf opened this issue May 2, 2017 · 3 comments
Closed

Weird behaviour on Github.io getDomain #93

ahmadassaf opened this issue May 2, 2017 · 3 comments
Labels

Comments

@ahmadassaf
Copy link

ahmadassaf commented May 2, 2017

Hello,

I noticed weird behaviour handling urls from the domain github.io using the getDomain method.

const tld  = require('tldjs');
console.log("tld", tld.getDomain("google.io")); --> google
console.log("tld", tld.getDomain("github.io")); --> null

and i get back null on github.io

You can check it live in here

UPDATE

The behaviour extends as well to other functions like getPublicSuffix:

console.log(tld.getPublicSuffix("google.io")); --> io
console.log(tld.getPublicSuffix("github.io")); --> github.io

Looking forward for your input.

@thom4parisot
Copy link
Owner

Hello @ahmadassaf,

that's odd indeed. Let me investigate this issue a bit and see how it goes.
In the meantime, feel free to share your own findings.

And thanks a lot for reporting the issue of course 🙂

@thom4parisot
Copy link
Owner

thom4parisot commented May 3, 2017

Okay gotcha. There is a rule in https://publicsuffix.org/list/public_suffix_list.dat with github.io and it demonstrates the negative side effect described in #25.

The publicSuffix method returns the expected result: github.io cannot be a domain on its own so cookies can only be created in subdomains under that same domain.

But what getDomain should really do, is to care differently about the rules and only acknowledge the known list of gTLDs (like .io, nhs.uk whatever.co.uk etc.).

I guess we can continue the conversation over there 🙂

@ahmadassaf
Copy link
Author

thanks @oncletom for the pointer .. moving over there :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants