pipermerriam/flex

parentheses ( ) not regex escaped

leon-vg opened this issue · 0 comments

I logged an issue in the Robot-Framework RESTinstance library, regarding an issue with parentheses ( ) in a swagger endpoint. asyrjasalo/RESTinstance#34

The issue is, in short, that an endpoint with parentheses cannot be found, while this is incorrect.

I tracked down the problem to the following file in this library: https://github.com/pipermerriam/flex/blob/master/flex/paths.py#L19

The problem seems to be resolved when I change the following code:

REGEX_REPLACEMENTS = (
    ('\.', '\.'),
    ('\{', '\{'),
    ('\}', '\}'),
)

to this:

REGEX_REPLACEMENTS = (
    ('\.', '\.'),
    ('\{', '\{'),
    ('\}', '\}'),
    ('\(', '\('),
    ('\)', '\)'),
)

I am not a python developer, otherwise I would have submitted a PR. I hope a more experienced developer can check if this change is appropriate and realize this change.