File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ def _build_url(self, path: str) -> str:
106106 ord (character ) < 32 or ord (character ) == 127 for character in decoded_path
107107 ):
108108 raise HyperbrowserError ("path must not contain control characters" )
109+ if "?" in decoded_path :
110+ raise HyperbrowserError ("path must not contain encoded query delimiters" )
111+ if "#" in decoded_path :
112+ raise HyperbrowserError ("path must not contain encoded fragment delimiters" )
109113 normalized_segments = [
110114 segment for segment in decoded_path .split ("/" ) if segment
111115 ]
Original file line number Diff line number Diff line change @@ -235,6 +235,14 @@ def test_client_build_url_rejects_empty_or_non_string_paths():
235235 HyperbrowserError , match = "path must not contain control characters"
236236 ):
237237 client ._build_url ("/api/%00segment" )
238+ with pytest .raises (
239+ HyperbrowserError , match = "path must not contain encoded query delimiters"
240+ ):
241+ client ._build_url ("/api/%3Fsegment" )
242+ with pytest .raises (
243+ HyperbrowserError , match = "path must not contain encoded fragment delimiters"
244+ ):
245+ client ._build_url ("/api/%23segment" )
238246 finally :
239247 client .close ()
240248
You can’t perform that action at this time.
0 commit comments