File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,23 @@ def _validate_path(path: str, append_slash: bool) -> None:
55
55
if not path .startswith ("/" ):
56
56
raise ValueError ("Path must start with a slash." )
57
57
58
+ if path .endswith ("/" ) and append_slash :
59
+ raise ValueError ("Cannot use append_slash=True when path ends with /" )
60
+
61
+ if "//" in path :
62
+ raise ValueError ("Path cannot contain double slashes." )
63
+
58
64
if "<>" in path :
59
65
raise ValueError ("All URL parameters must be named." )
60
66
61
- if path .endswith ("/" ) and append_slash :
62
- raise ValueError ("Cannot use append_slash=True when path ends with /" )
67
+ if re .search (r"[^/]<[^/]+>|<[^/]+>[^/]" , path ):
68
+ raise ValueError ("All URL parameters must be between slashes." )
69
+
70
+ if re .search (r"[^/.]\.\.\.\.?|\.?\.\.\.[^/.]" , path ):
71
+ raise ValueError ("... and .... must be between slashes" )
72
+
73
+ if "....." in path :
74
+ raise ValueError ("Path cannot contain more than 4 dots in a row." )
63
75
64
76
def matches (
65
77
self , method : str , path : str
You can’t perform that action at this time.
0 commit comments