json sanitize labels

This commit is contained in:
ThomasV 2014-09-05 12:12:00 +02:00
parent 0c8c21f64d
commit 9af2c20706
1 changed files with 8 additions and 1 deletions

View File

@ -219,9 +219,16 @@ class Plugin(BasePlugin):
for label in response:
decoded_key = self.decode(label["external_id"])
decoded_label = self.decode(label["text"])
decoded_label = self.decode(label["text"])
try:
json.dumps(decoded_key)
json.dumps(decoded_label)
except:
print_error('json error: cannot save label', decoded_key)
continue
if force or not self.wallet.labels.get(decoded_key):
self.wallet.labels[decoded_key] = decoded_label
self.wallet.storage.put('labels', self.wallet.labels)
return True
except socket.gaierror as e:
print_error('Error connecting to service: %s ' % e)