Skip to content

Commit

Permalink
Fix replaced - in allowed characters during object_id sanitizing (esp…
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored Dec 21, 2023
1 parent 5e2df0b commit 442820d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion esphome/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def snake_case(value):
return value.replace(" ", "_").lower()


_DISALLOWED_CHARS = re.compile(r"[^a-zA-Z0-9_]")
_DISALLOWED_CHARS = re.compile(r"[^a-zA-Z0-9-_]")


def sanitize(value):
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def test_snake_case(text, expected):
('!"§$%&/()=?foo_bar', "___________foo_bar"),
('foo_!"§$%&/()=?bar', "foo____________bar"),
('foo_bar!"§$%&/()=?', "foo_bar___________"),
('foo-bar!"§$%&/()=?', "foo-bar___________"),
),
)
def test_sanitize(text, expected):
Expand Down

0 comments on commit 442820d

Please sign in to comment.