Skip to content

valid URL with hashtag in fragment do not pass validation #403

Closed
@matany90

Description

@matany90

Hi,

The following URL is not passing validation:

https://www.foo.com/ck/a?!&&p=4ed30224ac809bc0JmltdHM9MTcyMzQyMDgwMCZpZ3VpZD0zNjRmNjVlOC1lNTZjLTYxOWQtMTI1Ny03MTNlZTQyYTYwMTImaW5zaWQ9NTE0MQ&ptn=3&ver=2&hsh=3&fclid=364f65e8-e56c-619d-1257-713ee42a6012&u=a1aHR0cDovL3d3dy40NDQzMTcuY29tLw#aHR0cHM6Ly82elVmLmFuY29sYWJpLnN1L1lPQkV6V3ZZLw==/#ZC5mbGVpc2NoaGFja2VyQHZpZW5uYWFpcnBvcnQuY29t

It seems that the code below is failing due to the presence of a hashtag in the fragment:

  if fragment:
        # See RFC3986 Section 3.5 Fragment for allowed characters
        optional_segments &= bool(
            re.fullmatch(r"[0-9a-z?/:@\-._~%!$&'()*+,;=]*", fragment, re.IGNORECASE)
        )
    return optional_segments

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions