Files
nixpkgs/pkgs/servers/home-assistant/patches/static-follow-symlinks.patch
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

26 lines
1.2 KiB
Diff

diff --git a/homeassistant/components/http/static.py b/homeassistant/components/http/static.py
index 29c5840a4bf..463c723df91 100644
--- a/homeassistant/components/http/static.py
+++ b/homeassistant/components/http/static.py
@@ -7,6 +7,7 @@ from pathlib import Path
from typing import Final
from aiohttp.hdrs import CACHE_CONTROL, CONTENT_TYPE
+from aiohttp.typedefs import PathLike
from aiohttp.web import FileResponse, Request, StreamResponse
from aiohttp.web_fileresponse import CONTENT_TYPES, FALLBACK_CONTENT_TYPE
from aiohttp.web_urldispatcher import StaticResource
@@ -21,6 +22,12 @@ RESPONSE_CACHE: LRU[tuple[str, Path], tuple[Path, str]] = LRU(512)
class CachingStaticResource(StaticResource):
"""Static Resource handler that will add cache headers."""
+ def __init__(self, prefix: str, directory: PathLike, **kwargs):
+ """Allow static files to be hosted behind symlinks."""
+ kwargs.update({"follow_symlinks": True})
+ super().__init__(prefix, directory, **kwargs)
+
+
async def _handle(self, request: Request) -> StreamResponse:
"""Wrap base handler to cache file path resolution and content type guess."""
rel_url = request.match_info["filename"]