dash icon indicating copy to clipboard operation
dash copied to clipboard

Fix path_template variable parsing containing dots

Open jowlo opened this issue 1 year ago • 8 comments

Using dots (.) and other special characters as part of a path_template for pages is currently not supported. This is due to the fact that path_template is passed to Python's regex module without escaping first, see #2437.

The PR escapes special regex characters in the path_template before parsing it. It also simplifies the way the parsing is done by using re.match.

As re.escape on Python 3.6 internally compiles the to-be-escaped string as regex pattern and throws errors for invalid patterns (which we have here), the function keeps a local copy of re._special_chars_map to escape these characters.

Contributor Checklist

  • [x] I have broken down my PR scope into the following TODO tasks
    • [x] Fix the path_template parsing
  • [ ] I have run the tests locally and they passed. (refer to testing section in contributing)
  • [x] I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

jowlo avatar Mar 02 '23 13:03 jowlo