Skip to content

Commit 3afb421

Browse files
Foscam-wangzhengyujoostlek
authored andcommitted
URL-encode the RTSP URL in the Foscam integration (home-assistant#156488)
Co-authored-by: Joost Lekkerkerker <[email protected]>
1 parent c166335 commit 3afb421

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

homeassistant/components/foscam/camera.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import asyncio
6+
from urllib.parse import quote
67

78
import voluptuous as vol
89

@@ -152,7 +153,9 @@ def camera_image(
152153
async def stream_source(self) -> str | None:
153154
"""Return the stream source."""
154155
if self._rtsp_port:
155-
return f"rtsp://{self._username}:{self._password}@{self._foscam_session.host}:{self._rtsp_port}/video{self._stream}"
156+
_username = quote(self._username)
157+
_password = quote(self._password)
158+
return f"rtsp://{_username}:{_password}@{self._foscam_session.host}:{self._rtsp_port}/video{self._stream}"
156159

157160
return None
158161

0 commit comments

Comments
 (0)