Skip to content

Commit c9585e9

Browse files
authored
Merge pull request #405 from davidt99/master
fix(url): add hashtag to allowed fragment characters
2 parents 597a030 + 1231f6a commit c9585e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/validators/url.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def _validate_optionals(path: str, query: str, fragment: str, strict_query: bool
144144
optional_segments &= True
145145
if fragment:
146146
# See RFC3986 Section 3.5 Fragment for allowed characters
147+
# Adding "#", see https://github.com/python-validators/validators/issues/403
147148
optional_segments &= bool(
148-
re.fullmatch(r"[0-9a-z?/:@\-._~%!$&'()*+,;=]*", fragment, re.IGNORECASE)
149+
re.fullmatch(r"[0-9a-z?/:@\-._~%!$&'()*+,;=#]*", fragment, re.IGNORECASE)
149150
)
150151
return optional_segments
151152

0 commit comments

Comments
 (0)