From a587044c1c24d422b704fbfc8a8f98c132c27d10 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 5 Mar 2025 12:56:50 -0600 Subject: [PATCH] Don't break picture URLs that already have a host --- custom_components/remote_homeassistant/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/remote_homeassistant/__init__.py b/custom_components/remote_homeassistant/__init__.py index 16148bd..e6e11f6 100644 --- a/custom_components/remote_homeassistant/__init__.py +++ b/custom_components/remote_homeassistant/__init__.py @@ -372,14 +372,18 @@ def _prefixed_entity_friendly_name(self, entity_friendly_name): return entity_friendly_name def _full_picture_url(self, url): + if re.match(r"^https?://", url): + return url + baseURL = "%s://%s:%s" % ( "https" if self._secure else "http", self._entry.data[CONF_HOST], self._entry.data[CONF_PORT], ) - if url.startswith(baseURL) == False: - url = baseURL + url + if url.startswith(baseURL): return url + + url = baseURL + url return url def set_connection_state(self, state):