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

getRegistrableDomain has unexpected behavior when given URLs with trailing paths #8

Open
miloprice opened this issue Feb 19, 2016 · 3 comments

Comments

@miloprice
Copy link

If you give it "example.com/path", or "example.com/", for example, the trailing / and anything after it are left in as part of the registrable domain. This actively causes problems if you send in a path directly to a filename with an extension (e.g., "example.com/path/image.jpg") because the method will interpret "com/path/image" as the domain name portion (and ".jpg" as the tld).

@malkusch
Copy link
Member

Thank you for the report. Before I take action I need to understand what disallowed_STD3_valid means.

@malkusch
Copy link
Member

Ok, now I see. / was valid in IDNA2003, but is now with IDNA2008 no more valid. I'll take care of that.

@HatScripts
Copy link

HatScripts commented Sep 25, 2016

Still having this issue on 2.2.0.

In addition, getRegistrableDomain returns the same string as the input URL when said URL begins with "https://" (Though not for URLs with subdomains);

| Input                         | Output              | Valid | | ----------------------------- | ------------------- | ----- | | https://www.github.com        | google.com          | ✔    | | https://www.example.com       | example.com         | ✔    | | https://www.google.com        | google.com          | ✔    | | https://subdomain.example.com | example.com         | ✔    | | https://github.com            | https://github.com  | ✘    | | https://example.com           | https://example.com | ✘    | | https://google.com            | https://google.com  | ✘    |

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

No branches or pull requests

3 participants