| 429 | self.app = app |
| 430 | |
| 431 | async def __call__(self, scope, receive, send): |
| 432 | if scope.get("type") in ("http", "websocket"): |
| 433 | root_path = scope.get("root_path", "") |
| 434 | path = scope.get("path", "") |
| 435 | if root_path and not path.startswith(root_path): |
| 436 | scope = {**scope, "path": root_path + path} |
| 437 | raw_path = scope.get("raw_path") |
| 438 | if isinstance(raw_path, (bytes, bytearray)): |
| 439 | scope["raw_path"] = root_path.encode("ascii") + bytes(raw_path) |
| 440 | await self.app(scope, receive, send) |
| 441 | |
| 442 | |
| 443 | def _clean_workspace_value(value: Any) -> str | None: |