utils: Improve safe formatter by handling more cases
Fixes: #2462 (closed).
-
When there are field retrievals and subscript based retrievals in the format string, exceptions are raised. Handle these safely.
-
This eliminates are error such as "Notification missing required key during translation: 'str' object has no attribute 'php");print(CONFIG'". when the notification message contains "{include_once("/var/www/html/config/config.php");print(CONFIG["dbpassword"] ?? ""); }"
Tests:
- Updated unit tests pass.
Signed-off-by: Sunil Mohan Adapa sunil@medhas.org