mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-27 19:16:29 +00:00
Guard addon self lookup (#1492)
This commit is contained in:
parent
fcdd66dc6e
commit
2a31edc768
@ -7,6 +7,7 @@ from aiohttp import web
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from ..addons import AnyAddon
|
from ..addons import AnyAddon
|
||||||
|
from ..addons.addon import Addon
|
||||||
from ..addons.utils import rating_security
|
from ..addons.utils import rating_security
|
||||||
from ..const import (
|
from ..const import (
|
||||||
ATTR_ADDONS,
|
ATTR_ADDONS,
|
||||||
@ -129,7 +130,10 @@ class APIAddons(CoreSysAttributes):
|
|||||||
|
|
||||||
# Lookup itself
|
# Lookup itself
|
||||||
if addon_slug == "self":
|
if addon_slug == "self":
|
||||||
return request.get(REQUEST_FROM)
|
addon = request.get(REQUEST_FROM)
|
||||||
|
if not isinstance(addon, Addon):
|
||||||
|
raise APIError("Self is not an Addon")
|
||||||
|
return addon
|
||||||
|
|
||||||
addon = self.sys_addons.get(addon_slug)
|
addon = self.sys_addons.get(addon_slug)
|
||||||
if not addon:
|
if not addon:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user