From e3d60d6c8a0ff5f9b8b7db200589524c367af2f4 Mon Sep 17 00:00:00 2001 From: Usama Ahsan Date: Tue, 24 Sep 2024 20:58:55 +0500 Subject: [PATCH] fix(rc2nix): correct regex for boolean values (#371) Fix a regular expression in the `nix_val` function to correctly match and convert boolean values. The adjustment ensures that only exact matches for 'true' or 'false' are handled, preventing partial matches. --- script/rc2nix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/rc2nix.py b/script/rc2nix.py index fd060ae..c59fd2a 100755 --- a/script/rc2nix.py +++ b/script/rc2nix.py @@ -276,7 +276,7 @@ class Rc2Nix: def nix_val(s: Optional[str]) -> str: if s is None: return "null" - if re.match(r"^true|false$", s, re.IGNORECASE): + if re.match(r"^(true|false)$", s, re.IGNORECASE): return s.lower() if re.match(r"^[0-9]+(\.[0-9]+)?$", s): return s