nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 25 lines 1.2 kB view raw
1diff --git a/homeassistant/components/http/static.py b/homeassistant/components/http/static.py 2index 29c5840a4bf..463c723df91 100644 3--- a/homeassistant/components/http/static.py 4+++ b/homeassistant/components/http/static.py 5@@ -7,6 +7,7 @@ from pathlib import Path 6 from typing import Final 7 8 from aiohttp.hdrs import CACHE_CONTROL, CONTENT_TYPE 9+from aiohttp.typedefs import PathLike 10 from aiohttp.web import FileResponse, Request, StreamResponse 11 from aiohttp.web_fileresponse import CONTENT_TYPES, FALLBACK_CONTENT_TYPE 12 from aiohttp.web_urldispatcher import StaticResource 13@@ -21,6 +22,12 @@ RESPONSE_CACHE: LRU[tuple[str, Path], tuple[Path, str]] = LRU(512) 14 class CachingStaticResource(StaticResource): 15 """Static Resource handler that will add cache headers.""" 16 17+ def __init__(self, prefix: str, directory: PathLike, **kwargs): 18+ """Allow static files to be hosted behind symlinks.""" 19+ kwargs.update({"follow_symlinks": True}) 20+ super().__init__(prefix, directory, **kwargs) 21+ 22+ 23 async def _handle(self, request: Request) -> StreamResponse: 24 """Wrap base handler to cache file path resolution and content type guess.""" 25 rel_url = request.match_info["filename"]