diff --git a/fastapi/routing.py b/fastapi/routing.py index eaaeee7481..512f718f8c 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -1506,7 +1506,9 @@ class APIRouter(routing.Router): ) elif isinstance(route, routing.Mount): if isinstance(route.app, StaticFiles): - self._mount(prefix + router.prefix + route.path, route.app, name=route.name) + self._mount( + prefix + router.prefix + route.path, route.app, name=route.name + ) for handler in router.on_startup: self.add_event_handler("startup", handler) for handler in router.on_shutdown: diff --git a/tests/test_apirouter_mount.py b/tests/test_apirouter_mount.py index 1a2de54822..e6c18b7687 100644 --- a/tests/test_apirouter_mount.py +++ b/tests/test_apirouter_mount.py @@ -1,4 +1,5 @@ """Tests for mounting StaticFiles under APIRouter (issue #10180).""" + from pathlib import Path import pytest