mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Add cache headers to picture integration (#39402)
This commit is contained in:
parent
b71cbd2033
commit
4688171ce0
@ -11,6 +11,7 @@ from aiohttp import hdrs, web
|
|||||||
from aiohttp.web_request import FileField
|
from aiohttp.web_request import FileField
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.components.http.static import CACHE_HEADERS
|
||||||
from homeassistant.components.http.view import HomeAssistantView
|
from homeassistant.components.http.view import HomeAssistantView
|
||||||
from homeassistant.const import CONF_ID
|
from homeassistant.const import CONF_ID
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -197,7 +198,8 @@ class ImageServeView(HomeAssistantView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return web.FileResponse(
|
return web.FileResponse(
|
||||||
target_file, headers={hdrs.CONTENT_TYPE: image_info["content_type"]}
|
target_file,
|
||||||
|
headers={**CACHE_HEADERS, hdrs.CONTENT_TYPE: image_info["content_type"]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user