kivy: sanitize on_qr
This commit is contained in:
parent
2881565de3
commit
dfdd072395
|
@ -240,12 +240,20 @@ class ElectrumWindow(App):
|
||||||
def on_qr(self, data):
|
def on_qr(self, data):
|
||||||
if data.startswith('bitcoin:'):
|
if data.startswith('bitcoin:'):
|
||||||
self.set_URI(data)
|
self.set_URI(data)
|
||||||
else:
|
return
|
||||||
from electrum.bitcoin import base_decode
|
# try to decode transaction
|
||||||
from electrum.transaction import Transaction
|
from electrum.bitcoin import base_decode
|
||||||
|
from electrum.transaction import Transaction
|
||||||
|
try:
|
||||||
text = base_decode(data, None, base=43).encode('hex')
|
text = base_decode(data, None, base=43).encode('hex')
|
||||||
tx = Transaction(text)
|
tx = Transaction(text)
|
||||||
|
except:
|
||||||
|
tx = None
|
||||||
|
if tx:
|
||||||
self.tx_dialog(tx)
|
self.tx_dialog(tx)
|
||||||
|
return
|
||||||
|
# show error
|
||||||
|
self.show_error("Unable to decode QR data")
|
||||||
|
|
||||||
def update_tab(self, name):
|
def update_tab(self, name):
|
||||||
s = getattr(self, name + '_screen', None)
|
s = getattr(self, name + '_screen', None)
|
||||||
|
|
Loading…
Reference in New Issue