Skip to content

URL validation fails on Russian punycode TLD #63

Closed

Description

>>> url('http://президент.рф/')
ValidationFailure(func=url, args={'public': False, 'value': 'http://\xd0\xbf\xd1\x80\xd0\xb5\xd0\xb7\xd0\xb8\xd0\xb4\xd0\xb5\xd0\xbd\xd1\x82.\xd1\x80\xd1\x84/'})
>>> url('http://xn--d1abbgf6aiiy.xn--p1ai/')
ValidationFailure(func=url, args={'public': False, 'value': 'http://xn--d1abbgf6aiiy.xn--p1ai/'})

Yet these are valid URLs, see https://en.wikipedia.org/wiki/.%D1%80%D1%84

The domain has an ASCII representation of xn--p1ai derived as Punycode

Activity

  1. kvesteri commented on Aug 16, 2017

    @kvesteri
    Collaborator

    PRs welcome!

  2. bovlb commented on Aug 24, 2017

    @bovlb

    Here is a workaround for the second case:
    u = urllib.parse.urlparse(url);
    validators.url(u._replace(netloc = idna.decode(u.netloc)).geturl())

  3. added
    bugIssue: Works not as designed
    outdatedIssue/PR: Open for more than 3 months
    on Mar 14, 2023
  4. added a commit that references this issue on Mar 17, 2023
    c43826c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue: Works not as designedoutdatedIssue/PR: Open for more than 3 months

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions