-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support more special chars in camera passwords (#4259)
* Support more special chars in camera passwords * End password test with double @ chars * Escape passwords in paths for go2rtc * Fixes for formatting
- Loading branch information
Showing
4 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ | |
class TestUserPassCleanup(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.rtsp_with_pass = "rtsp://user:[email protected]:554/live" | ||
self.rtsp_with_special_pass = "rtsp://user:password#$@@192.168.0.2:554/live" | ||
self.rtsp_with_special_pass = ( | ||
"rtsp://user:password`~!@#$%^&*()-_;',.<>:\"\{\}\[\]@@192.168.0.2:554/live" | ||
) | ||
self.rtsp_no_pass = "rtsp://192.168.0.3:554/live" | ||
|
||
def test_cleanup(self): | ||
|
@@ -25,7 +27,10 @@ def test_no_cleanup(self): | |
def test_special_char_password(self): | ||
"""Test that special characters in pw are escaped, but not others.""" | ||
escaped = escape_special_characters(self.rtsp_with_special_pass) | ||
assert escaped == "rtsp://user:password%23%24%[email protected]:554/live" | ||
assert ( | ||
escaped | ||
== "rtsp://user:password%60~%21%40%23%24%25%5E%26%2A%28%29-_%3B%27%2C.%3C%3E%3A%22%5C%7B%5C%7D%5C%5B%5C%5D%[email protected]:554/live" | ||
) | ||
|
||
def test_no_special_char_password(self): | ||
"""Test that no change is made to path with no special characters.""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters