Skip to content

Commit a92748a

Browse files
committed
Trim unwanted prefix for python routes
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
1 parent 853056f commit a92748a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

atom_tools/lib/converter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ def _parse_path_regexes(self, endpoint: str) -> str:
418418
"""
419419
if '(' in endpoint:
420420
endpoint = regex.extract_parentheses.sub(fwd_slash_repl, endpoint)
421-
endpoint_elements = endpoint.lstrip('/').lstrip("{}").rstrip('$').rstrip('/').split('/')
421+
endpoint_elements = endpoint.lstrip('/').rstrip('$').rstrip('/').split('/')
422422
endpoint_elements = [
423-
i.lstrip('/').lstrip("{}").lstrip('^').rstrip('/').rstrip('$').replace('$L@$H', '/')
423+
i.lstrip('/').lstrip('^').rstrip('/').rstrip('$').replace('$L@$H', '/')
424424
for i in endpoint_elements
425425
]
426426
params = []
@@ -429,13 +429,13 @@ def _parse_path_regexes(self, endpoint: str) -> str:
429429
if regex.detect_regex.search(i):
430430
e, b = self._check_path_elements_regex(i)
431431
if e:
432-
new_endpoint += f'/{e.lstrip("{}")}'
432+
new_endpoint += f'/{e}'
433433
params.extend(b)
434434
elif i:
435-
new_endpoint += f'/{i.lstrip("{}")}'
435+
new_endpoint += f'/{i}'
436436
if params:
437437
self.params[new_endpoint] = params
438-
return new_endpoint
438+
return new_endpoint.replace("/{}", "/")
439439

440440
def _process_calls(self, method_map: Dict) -> Dict[str, Any]:
441441
"""

0 commit comments

Comments
 (0)