mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 08:21:27 +00:00
json sanitize labels
This commit is contained in:
parent
0c8c21f64d
commit
9af2c20706
1 changed files with 8 additions and 1 deletions
|
@ -219,9 +219,16 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
for label in response:
|
for label in response:
|
||||||
decoded_key = self.decode(label["external_id"])
|
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):
|
if force or not self.wallet.labels.get(decoded_key):
|
||||||
self.wallet.labels[decoded_key] = decoded_label
|
self.wallet.labels[decoded_key] = decoded_label
|
||||||
|
self.wallet.storage.put('labels', self.wallet.labels)
|
||||||
return True
|
return True
|
||||||
except socket.gaierror as e:
|
except socket.gaierror as e:
|
||||||
print_error('Error connecting to service: %s ' % e)
|
print_error('Error connecting to service: %s ' % e)
|
||||||
|
|
Loading…
Add table
Reference in a new issue