Skip to content

Commit 1d16fa7

Browse files
authored
Hotfix 3.
Hotfix 3.
1 parent 0f0fa73 commit 1d16fa7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

flet_navigator/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
from typing import Union
1414

1515

16-
FLET_NAVIGATOR_VERSION: float = '2.1.2'
16+
FLET_NAVIGATOR_VERSION: float = '2.1.3'
1717
"""Flet Navigator Version."""
1818

1919
ROUTE_404: str = 'ROUTE-404'
2020
"""Route 404 Typehint."""
2121

22-
URL_FN_SPACE_CHARACTER: str = '_0ss_'
22+
URL_FN_SPACE_CHARACTER: str = '_$urlspace_'
2323
"""FletNavigator URL Space Character."""
2424

2525
class PageData:
@@ -164,7 +164,7 @@ class FletNavigator:
164164
_nav_temp_args: tuple[Any] = None
165165

166166
_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+~`!@"#№$;%^:*-,.|\/\\<>\'{}[\]()-]+))*$'
168168

169169
_nav_is_float_re: str = r'^-?\d+\.\d+$'
170170

@@ -245,7 +245,7 @@ def get_route_data(self, route: str) -> Any:
245245
return None
246246

247247
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)
249249

250250
if route.startswith('/') and len(route) >= 2: route = route[1:]
251251

@@ -275,12 +275,12 @@ def _nav_route_change_handler(self, _) -> None:
275275
if _parameter_parsed[1].isdigit(): parameters[_parameter_parsed[0]] = int(_parameter_parsed[1])
276276
elif re_compile(self._nav_is_float_re).match(_parameter_parsed[1]): parameters[_parameter_parsed[0]] = float(_parameter_parsed[1])
277277
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, ' ')
279279

280280
self.route = route.split('?')[0]
281281

282282
else:
283-
self.route = route
283+
self.route = route.split('?')[0] # In case user did a syntax error.
284284

285285
self.render(self.page, self._nav_temp_args, parameters)
286286

0 commit comments

Comments
 (0)