Skip to content

Commit

Permalink
allow pct-encoded entities in fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
conitrade-as committed Nov 7, 2023
1 parent 8f11597 commit 38d196a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/validators/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ 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
optional_segments &= bool(re.fullmatch(r"[0-9a-zA-Z?/:@\-._~!$&'()*+,;=]*", fragment))
optional_segments &= bool(re.fullmatch(r"[0-9a-zA-Z?/:@\-._~%!$&'()*+,;=]*", fragment))
return optional_segments


Expand Down
1 change: 1 addition & 0 deletions tests/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"https://www.foo.com/bar#/baz/test",
"https://matrix.to/#/!BSqRHgvCtIsGittkBG:talk.puri.sm/$1551464398"
+ "853539kMJNP:matrix.org?via=talk.puri.sm&via=matrix.org&via=disroot.org",
"https://example.org/path#2022%201040%20(Cornelius%20Morgan%20G).pdf",
# when simple_host=True
# "http://localhost",
# "http://localhost:8000",
Expand Down

0 comments on commit 38d196a

Please sign in to comment.