Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/module_utils/netbox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,10 @@ def _to_slug(self, value):
return value
else:
removed_chars = re.sub(r"[^\-\.\w\s]", "", value)
removed_chars = removed_chars.encode('ascii', errors="ignore").decode()
removed_chars = removed_chars.strip()
convert_chars = re.sub(r"[\-\.\s]+", "-", removed_chars)
return convert_chars.strip().lower()
return convert_chars.lower()

def _normalize_data(self, data):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/module_utils/test_data/normalize_data/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
},
{
"before": {
"slug": "Test to_slug"
"slug": "Test to_slug© ⅛ äüöß 👀"
},
"after": {
"slug": "test-to_slug"
Expand Down Expand Up @@ -345,4 +345,4 @@
"mac_address": "AA:BB:CC:DD:EE:FF"
}
}
]
]