@@ -153,7 +153,11 @@ def __init__(self, regex, name=None, is_endpoint=False):
153
153
self.converters = {}
154
154
155
155
def match(self, path):
156
-
match = self.regex.search(path)
156
+
match = (
157
+
self.regex.fullmatch(path)
158
+
if self._is_endpoint and self.regex.pattern.endswith('$')
159
+
else self.regex.search(path)
160
+
)
157
161
if match:
158
162
# If there are any named groups, use those as kwargs, ignoring
159
163
# non-named groups. Otherwise, pass all non-named arguments as
@@ -240,7 +244,7 @@ def _route_to_regex(route, is_endpoint=False):
240
244
converters[parameter] = converter
241
245
parts.append('(?P<' + parameter + '>' + converter.regex + ')')
242
246
if is_endpoint:
243
-
parts.append('$')
247
+
parts.append(r'\Z')
244
248
return ''.join(parts), converters
245
249
246
250
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4