diff --git a/sanic/router.py b/sanic/router.py index cbae0292..ab7e826b 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -24,7 +24,7 @@ class Router: """ routes = None regex_types = { - "string": (None, "\w+"), + "string": (None, "[^/]+"), "int": (int, "\d+"), "number": (float, "[0-9\\.]+"), "alpha": (None, "[A-Za-z]+"), diff --git a/tests/test_routes.py b/tests/test_routes.py index c1885271..640f3422 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -39,6 +39,11 @@ def test_dynamic_route_string(): assert response.text == 'OK' assert results[0] == 'test123' + request, response = sanic_endpoint_test(app, uri='/folder/favicon.ico') + + assert response.text == 'OK' + assert results[1] == 'favicon.ico' + def test_dynamic_route_int(): app = Sanic('test_dynamic_route_int')