File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/common/providers/address_resolver Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,20 @@ def path_to_path_items(path: str) -> list[AttributeItem | QueryItem | IdItem]:
2828 """Split up the path into path items.
2929 The path used as input to this function should not include protocol or data source.
3030 """
31+ # Validate no nested or unbalanced parentheses in path
32+ depth = 0
33+ for char in path :
34+ if char == "(" :
35+ depth += 1
36+ if depth > 1 :
37+ raise ValueError (f"Nested parentheses are not supported in path: { path } " )
38+ elif char == ")" :
39+ depth -= 1
40+ if depth < 0 :
41+ raise ValueError (f"Unbalanced parentheses in path: { path } " )
42+ if depth != 0 :
43+ raise ValueError (f"Unbalanced parentheses in path: { path } " )
44+
3145 queries = re .findall (r"\(([^()]+)\)" , path )
3246 if queries :
3347 # Split the path into the pieces surrounding the queries and remove trailing [( and )]
You can’t perform that action at this time.
0 commit comments