mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Avoid netloc ipaddress re-encoding to construct ingress urls (#116431)
This commit is contained in:
parent
ff104f54b5
commit
6be2b334d8
@ -67,15 +67,15 @@ class HassIOIngress(HomeAssistantView):
|
|||||||
"""Initialize a Hass.io ingress view."""
|
"""Initialize a Hass.io ingress view."""
|
||||||
self._host = host
|
self._host = host
|
||||||
self._websession = websession
|
self._websession = websession
|
||||||
|
self._url = URL(f"http://{host}")
|
||||||
|
|
||||||
@lru_cache
|
@lru_cache
|
||||||
def _create_url(self, token: str, path: str) -> URL:
|
def _create_url(self, token: str, path: str) -> URL:
|
||||||
"""Create URL to service."""
|
"""Create URL to service."""
|
||||||
base_path = f"/ingress/{token}/"
|
base_path = f"/ingress/{token}/"
|
||||||
url = f"http://{self._host}{base_path}{quote(path)}"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
target_url = URL(url)
|
target_url = self._url.join(URL(f"{base_path}{quote(path)}"))
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
raise HTTPBadRequest from err
|
raise HTTPBadRequest from err
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user