mirror of
https://github.com/nix-community/plasma-manager.git
synced 2024-11-29 15:03:49 +03:00
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.
This commit is contained in:
parent
d3b59aea14
commit
e3d60d6c8a
@ -276,7 +276,7 @@ class Rc2Nix:
|
|||||||
def nix_val(s: Optional[str]) -> str:
|
def nix_val(s: Optional[str]) -> str:
|
||||||
if s is None:
|
if s is None:
|
||||||
return "null"
|
return "null"
|
||||||
if re.match(r"^true|false$", s, re.IGNORECASE):
|
if re.match(r"^(true|false)$", s, re.IGNORECASE):
|
||||||
return s.lower()
|
return s.lower()
|
||||||
if re.match(r"^[0-9]+(\.[0-9]+)?$", s):
|
if re.match(r"^[0-9]+(\.[0-9]+)?$", s):
|
||||||
return s
|
return s
|
||||||
|
Loading…
Reference in New Issue
Block a user