mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
Fixes #11758 - replace unsafe chars in menu label
This commit is contained in:
parent
25278becef
commit
90ecc86e11
@ -21,7 +21,18 @@ class PluginMenu:
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.label.replace(' ', '_')
|
||||
special_chars = [
|
||||
' ', '*', '/', '?', '>', '<', '\\', '|', '"', ':',
|
||||
';', ',', '.', '#', '+', '=', '!', '@', '$', '%',
|
||||
'^', '&', '(', ')', '[', ']', '{', '}', '`', '~'
|
||||
]
|
||||
new_name = ''
|
||||
for char in self.label:
|
||||
if char in special_chars:
|
||||
new_name += '_'
|
||||
else:
|
||||
new_name += char
|
||||
return new_name
|
||||
|
||||
|
||||
class PluginMenuItem:
|
||||
|
Loading…
Reference in New Issue
Block a user