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

Domainatrex crashes on amazon aws links #3

Closed
axelson opened this issue Jun 29, 2017 · 5 comments
Closed

Domainatrex crashes on amazon aws links #3

axelson opened this issue Jun 29, 2017 · 5 comments

Comments

@axelson
Copy link

axelson commented Jun 29, 2017

I expect domainatrex to be able to parse amazon s3 links properly. So Domainatrex.parse("s3.amazonaws.com") should succeed. Instead it throws the following error:

 ** (MatchError) no match of right hand side value: []
 stacktrace:
   (domainatrex) lib/domainatrex.ex:55: Domainatrex.format_response/2
   (domainatrex) lib/domainatrex.ex:34: Domainatrex.match/1
   test/domainatrex_test.exs:19: (test)

Failing test case:

  test "s3" do
    domain = "s3.amazonaws.com"
    assert Domainatrex.parse(domain) == {:ok, %{domain: "amazon", subdomain: "s3", tld: "com"}}
  end

I think Domainatrex can probably ignore all private domains in the public suffix list. Although there may be a better solution.

@Zensavona
Copy link
Owner

Hi Jason! Thanks for the catch, I'll implement a fix shortly 👍

@Zensavona
Copy link
Owner

This is fixed in 2.1.0 (avail. on hex now), hope this helps you!

@axelson
Copy link
Author

axelson commented Jul 3, 2017

Thanks! Out of curiosity how did you fix this?

@Zensavona
Copy link
Owner

Here's the change :) 0b7e4bf#diff-218dcb9de23a64bad83597eed095780fR25

@andreogle
Copy link

Sorry to bring resurrect this old issue, but I'm getting an error trying to parse similar URLs. Specifically paths that contain execute-api.[region].amazonaws.com

iex(1)> Domainatrex.parse("1234.execute-api.us-east-1.amazonaws.com")
{:error, "Cannot parse: invalid domain"}

# note the extra "s"
iex(2)> Domainatrex.parse("1234.execute-api.us-east-1.amazonawss.com")
{:ok, %{domain: "amazonawss", tld: "com", subdomain: "1234.execute-api.us-east-1"}}

This is on Domainatrex v3.0.3

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