Is_allowed_path raise for None path (#8953)
* is_allowed_path * Fix #8948 * assert path is not None * Update test_core.py * Update test_core.py * Update test_core.py
This commit is contained in:
parent
5309006494
commit
1892eb654f
2 changed files with 5 additions and 0 deletions
|
@ -1079,6 +1079,8 @@ class Config(object):
|
|||
|
||||
def is_allowed_path(self, path: str) -> bool:
|
||||
"""Check if the path is valid for access from outside."""
|
||||
assert path is not None
|
||||
|
||||
parent = pathlib.Path(path).parent
|
||||
try:
|
||||
parent = parent.resolve() # pylint: disable=no-member
|
||||
|
|
|
@ -833,6 +833,9 @@ class TestConfig(unittest.TestCase):
|
|||
for path in unvalid:
|
||||
assert not self.config.is_allowed_path(path)
|
||||
|
||||
with self.assertRaises(AssertionError):
|
||||
self.config.is_allowed_path(None)
|
||||
|
||||
|
||||
@patch('homeassistant.core.monotonic')
|
||||
def test_create_timer(mock_monotonic, loop):
|
||||
|
|
Loading…
Add table
Reference in a new issue