mirror of
https://github.com/evilsocket/opensnitch.git
synced 2026-05-09 20:22:26 +00:00
Merge pull request #1572 from marcpinolpique/fix/rule-name-action-mismatch
Fix rule filename not updating when action changes
This commit is contained in:
@@ -894,5 +894,13 @@ class RulesEditorDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
||||
if self.ruleNameEdit.text() == "":
|
||||
self.rule.name = slugify("%s %s %s" % (self.rule.action, self.rule.operator.type, self.rule.operator.data))
|
||||
elif self._old_rule_name is not None:
|
||||
# If the rule name was auto-generated (starts with an action prefix),
|
||||
# and the action has changed, update the prefix to match the new action.
|
||||
for old_action in (Config.ACTION_ALLOW, Config.ACTION_DENY, Config.ACTION_REJECT):
|
||||
if self._old_rule_name.startswith(old_action + "-") and old_action != self.rule.action:
|
||||
self.rule.name = self.rule.action + self._old_rule_name[len(old_action):]
|
||||
self.ruleNameEdit.setText(self.rule.name)
|
||||
break
|
||||
|
||||
return True, ""
|
||||
|
||||
Reference in New Issue
Block a user