File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
## [ unreleased]
10
10
11
11
## [ 0.29.0] - 2025-02-17
12
+ - ** [ Breaking] Makes URL path normalization case sensitive**
13
+ - Updates ` normalise_url_path_or_throw_error ` to be case sensitive
14
+ - URL paths will not be converted to lower-case, and will be kept as-is.
12
15
- Fixes an issue where ` removeDevice ` API allowed removing TOTP devices without the user completing MFA.
13
16
- Brings SDK in-line with Node SDK v21.1.0
14
17
Original file line number Diff line number Diff line change @@ -45,11 +45,15 @@ def is_a_recipe_path(self) -> bool:
45
45
46
46
47
47
def normalise_url_path_or_throw_error (input_str : str ) -> str :
48
+ """
49
+ Normalize URLs and obtain their path.
50
+ """
48
51
input_str = input_str .strip ()
49
52
input_str_lower = input_str .lower ()
50
53
51
54
try :
52
55
if not input_str_lower .startswith (("http://" , "https://" )):
56
+ # Raise and fall-through to handling below
53
57
raise Exception ("converting to proper URL" )
54
58
55
59
url_obj = urlparse (input_str )
@@ -62,15 +66,18 @@ def normalise_url_path_or_throw_error(input_str: str) -> str:
62
66
except Exception :
63
67
pass
64
68
69
+ # URL specifies a domain but no scheme, try parsing with scheme added
65
70
if (
66
71
domain_given (input_str_lower ) or input_str_lower .startswith ("localhost" )
67
72
) and not input_str_lower .startswith (("http://" , "https://" )):
68
73
input_str = "http://" + input_str
69
74
return normalise_url_path_or_throw_error (input_str )
70
75
76
+ # Only a path given, add a leading slash
71
77
if not input_str .startswith ("/" ):
72
78
input_str = "/" + input_str
73
79
80
+ # Parse the path with a dummy scheme and domain
74
81
try :
75
82
urlparse (f"http://example.com{ input_str } " )
76
83
return normalise_url_path_or_throw_error (f"http://example.com{ input_str } " )
You can’t perform that action at this time.
0 commit comments