Skip to content

Commit

Permalink
fixed stripping spaces for list values
Browse files Browse the repository at this point in the history
  • Loading branch information
natankeddem committed Oct 2, 2024
1 parent 5a3bb02 commit a3e0703
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions autopve/tabs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ def set_key(self, key: str, value: str):
if len(value) > 0:
if key in self.keys and "type" in self.keys[key]:
if self.keys[key]["type"] == "list" and len(value) > 2 and value.strip()[0] == "[" and value.strip()[-1] == "]":
v = value.replace(" ", "").strip()[1:-1].replace('"', "").replace("'", "").split(",")
l = value.strip()[1:-1].replace('"', "").replace("'", "").split(",")
v = [v.strip() for v in l]
elif self.keys[key]["type"] == "int":
v = int(value)
else:
v = value
else:
if len(value) > 2 and value.strip()[0] == "[" and value.strip()[-1] == "]":
v = value.replace(" ", "").strip()[1:-1].replace('"', "").replace("'", "").split(",")
l = value.strip()[1:-1].replace('"', "").replace("'", "").split(",")
v = [v.strip() for v in l]
elif value.isnumeric():
v = int(value)
else:
Expand Down

0 comments on commit a3e0703

Please sign in to comment.