xfconf: remove bogus string sanitisation

This commit is contained in:
dece 2020-09-28 23:04:16 +02:00
parent 28f1dbb4a1
commit 961180dab1
2 changed files with 5 additions and 14 deletions

View file

@ -80,14 +80,12 @@ class Xfconf:
prop_type = Xfconf.convert_type(prop_type)
if not prop_type:
return False
value = Xfconf.sanitize_str(value)
output = self.xq(["-c", channel, "-p", prop, "-n",
"-t", prop_type, "-s", value])
return output == ""
def update_property(self, channel, prop, value):
"""Update an existing property, return True on success."""
value = Xfconf.sanitize_str(value)
output = self.xq(["-c", channel, "-p", prop, "-s", value])
return output == ""
@ -102,7 +100,7 @@ class Xfconf:
subtype = Xfconf.convert_type(value["type"])
if not subtype:
return False
subvalue = Xfconf.sanitize_str(value["value"])
subvalue = value["value"]
command += ["-t", subtype, "-s", subvalue]
output = self.xq(command)
return output == ""
@ -129,14 +127,6 @@ class Xfconf:
print(f"Unknown gtype {gtype}.")
return xq_type
@staticmethod
def sanitize_str(value):
"""Wrap value with doublequotes if it contains whitespaces."""
for char in string.whitespace:
if char in value:
return f'"{value}"'
return value
XION_PROP_RE = re.compile(r"t:(\S+) (.+)")

View file

@ -67,7 +67,8 @@ class Xion:
if confirm and input("Confirm? [y/N]") != "y":
print("Operation cancelled.")
return False
if replace and not self.clear_tree(channel, root):
if replace:
if not self.clear_tree(channel, root):
print("Failed to clear properties.")
return False
for prop, content in tree.items():