Skip to content

Don't break picture URLs that already have a host #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions custom_components/remote_homeassistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down