Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
Fix idna bug
Browse files Browse the repository at this point in the history
  • Loading branch information
beerlington committed Jun 20, 2023
1 parent 567a88e commit 40dc0bc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/public_suffix/rules_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ defmodule PublicSuffix.RulesParser do

@doc false
def punycode_domain(rule) do
rule
|> :unicode.characters_to_list()
|> idna_call()
|> to_string
try do
punyrule = :idna.to_ascii(rule)
to_string(punyrule)
catch
:exit, _ -> rule
end
end

def idna_call('!' ++ char_list), do: '!' ++ idna_call(char_list)
Expand Down

0 comments on commit 40dc0bc

Please sign in to comment.