Skip to content

Commit

Permalink
Merge pull request #405 from davidt99/master
Browse files Browse the repository at this point in the history
fix(url): add hashtag to allowed fragment characters
  • Loading branch information
yozachar authored Oct 7, 2024
2 parents 597a030 + 1231f6a commit c9585e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/validators/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ def _validate_optionals(path: str, query: str, fragment: str, strict_query: bool
optional_segments &= True
if fragment:
# See RFC3986 Section 3.5 Fragment for allowed characters
# Adding "#", see https://github.com/python-validators/validators/issues/403
optional_segments &= bool(
re.fullmatch(r"[0-9a-z?/:@\-._~%!$&'()*+,;=]*", fragment, re.IGNORECASE)
re.fullmatch(r"[0-9a-z?/:@\-._~%!$&'()*+,;=#]*", fragment, re.IGNORECASE)
)
return optional_segments

Expand Down

0 comments on commit c9585e9

Please sign in to comment.