Replace wrong domain returned from xbox api revisited (#51074)

* Added replacement http to https

Somehow the fix of replacing the domain doesn't work on android, so explicit replacement of http to https protocol is needed.

* Update homeassistant/components/xbox/base_sensor.py

Co-authored-by: Jason Hunter <hunterjm@gmail.com>

Co-authored-by: Jason Hunter <hunterjm@gmail.com>
This commit is contained in:
Johan Josua Storm 2021-05-26 08:01:35 +02:00 committed by GitHub
parent c302b5d4eb
commit 9b13350b01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,7 @@ class XboxBaseSensorEntity(CoordinatorEntity):
# We need to also remove the 'mode=Padding' query because with it, it results in an error 400.
url = URL(self.data.display_pic)
if url.host == "images-eds.xboxlive.com":
url = url.with_host("images-eds-ssl.xboxlive.com")
url = url.with_host("images-eds-ssl.xboxlive.com").with_scheme("https")
query = dict(url.query)
query.pop("mode", None)
return str(url.with_query(query))