Skip to content

Commit

Permalink
fix(rc2nix): correct regex for boolean values (#371)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
usama8800 authored Sep 24, 2024
1 parent d3b59ae commit e3d60d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion script/rc2nix.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def pp_shortcuts(self, groups: Dict[str, Dict[str, str]], indent: int) -> str:
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
Expand Down

0 comments on commit e3d60d6

Please sign in to comment.