Fixes #11758 - replace unsafe chars in menu label

This commit is contained in:
rganascim 2023-02-25 14:13:10 -03:00
parent 90ecc86e11
commit c57030a678

View File

@ -1,5 +1,6 @@
from netbox.navigation import MenuGroup
from utilities.choices import ButtonColorChoices
from django.utils.text import slugify
__all__ = (
'PluginMenu',
@ -21,18 +22,7 @@ class PluginMenu:
@property
def name(self):
special_chars = [
' ', '*', '/', '?', '>', '<', '\\', '|', '"', ':',
';', ',', '.', '#', '+', '=', '!', '@', '$', '%',
'^', '&', '(', ')', '[', ']', '{', '}', '`', '~'
]
new_name = ''
for char in self.label:
if char in special_chars:
new_name += '_'
else:
new_name += char
return new_name
return slugify(self.label)
class PluginMenuItem: