|
13 | 13 | from typing import Union |
14 | 14 |
|
15 | 15 |
|
16 | | -FLET_NAVIGATOR_VERSION: float = '2.1.2' |
| 16 | +FLET_NAVIGATOR_VERSION: float = '2.1.3' |
17 | 17 | """Flet Navigator Version.""" |
18 | 18 |
|
19 | 19 | ROUTE_404: str = 'ROUTE-404' |
20 | 20 | """Route 404 Typehint.""" |
21 | 21 |
|
22 | | -URL_FN_SPACE_CHARACTER: str = '_0ss_' |
| 22 | +URL_FN_SPACE_CHARACTER: str = '_$urlspace_' |
23 | 23 | """FletNavigator URL Space Character.""" |
24 | 24 |
|
25 | 25 | class PageData: |
@@ -164,7 +164,7 @@ class FletNavigator: |
164 | 164 | _nav_temp_args: tuple[Any] = None |
165 | 165 |
|
166 | 166 | _nav_route_simple_re: str = r'^[a-zA-Z_]\w*$' |
167 | | - _nav_route_advanced_re: str = r'^[a-zA-Z_]\w*\?\w+=(?:[\w+]+)(?:&\w+=(?:[\w+]+))*$' |
| 167 | + _nav_route_advanced_re: str = r'^[a-zA-Z_]\w*\?\w+=(?:[\w+~`!@"#№$;%^:*-,.|\/\\<>\'{}[\]()-]+)(?:&\w+=(?:[\w+~`!@"#№$;%^:*-,.|\/\\<>\'{}[\]()-]+))*$' |
168 | 168 |
|
169 | 169 | _nav_is_float_re: str = r'^-?\d+\.\d+$' |
170 | 170 |
|
@@ -245,7 +245,7 @@ def get_route_data(self, route: str) -> Any: |
245 | 245 | return None |
246 | 246 |
|
247 | 247 | def _nav_route_change_handler(self, _) -> None: |
248 | | - route: str = self.page.route.replace(' ', URL_FN_SPACE_CHARACTER).replace('%20', URL_FN_SPACE_CHARACTER) |
| 248 | + route: str = self.page.route.replace(' ', URL_FN_SPACE_CHARACTER).replace('%20', URL_FN_SPACE_CHARACTER).replace('+', URL_FN_SPACE_CHARACTER) |
249 | 249 |
|
250 | 250 | if route.startswith('/') and len(route) >= 2: route = route[1:] |
251 | 251 |
|
@@ -275,12 +275,12 @@ def _nav_route_change_handler(self, _) -> None: |
275 | 275 | if _parameter_parsed[1].isdigit(): parameters[_parameter_parsed[0]] = int(_parameter_parsed[1]) |
276 | 276 | elif re_compile(self._nav_is_float_re).match(_parameter_parsed[1]): parameters[_parameter_parsed[0]] = float(_parameter_parsed[1]) |
277 | 277 | elif _parameter_parsed[1] in ['true', 'false']: parameters[_parameter_parsed[0]] = bool(_parameter_parsed[1]) |
278 | | - else: parameters[_parameter_parsed[0]] = _parameter_parsed[1].replace(URL_FN_SPACE_CHARACTER, ' ').replace('+', URL_FN_SPACE_CHARACTER) |
| 278 | + else: parameters[_parameter_parsed[0]] = _parameter_parsed[1].replace(URL_FN_SPACE_CHARACTER, ' ') |
279 | 279 |
|
280 | 280 | self.route = route.split('?')[0] |
281 | 281 |
|
282 | 282 | else: |
283 | | - self.route = route |
| 283 | + self.route = route.split('?')[0] # In case user did a syntax error. |
284 | 284 |
|
285 | 285 | self.render(self.page, self._nav_temp_args, parameters) |
286 | 286 |
|
|
0 commit comments