mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Change error handling in async_process_play_media_url (#90052)
This commit is contained in:
parent
9b9ed21dc4
commit
19d56a7102
@ -44,7 +44,7 @@ def async_process_play_media_url(
|
|||||||
return media_content_id
|
return media_content_id
|
||||||
else:
|
else:
|
||||||
if media_content_id[0] != "/":
|
if media_content_id[0] != "/":
|
||||||
raise ValueError("URL is relative, but does not start with a /")
|
return media_content_id
|
||||||
|
|
||||||
if parsed.query:
|
if parsed.query:
|
||||||
logging.getLogger(__name__).debug(
|
logging.getLogger(__name__).debug(
|
||||||
|
@ -86,8 +86,8 @@ async def test_process_play_media_url(hass: HomeAssistant, mock_sign_path) -> No
|
|||||||
== "http://example.local:8123/api/tts_proxy/bla"
|
== "http://example.local:8123/api/tts_proxy/bla"
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.raises(ValueError):
|
# Not changing a URL which is not absolute and does not start with /
|
||||||
async_process_play_media_url(hass, "hello")
|
async_process_play_media_url(hass, "hello") == "hello"
|
||||||
|
|
||||||
|
|
||||||
async def test_process_play_media_url_for_addon(
|
async def test_process_play_media_url_for_addon(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user