mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
transactions (qt): fix opening raw bytes files
(both when trying to "load tx from file", and "load tx from text" > "browse file")
This commit is contained in:
parent
85a4811742
commit
9ff7d2c5a7
2 changed files with 8 additions and 3 deletions
|
@ -2755,7 +2755,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||||
if not fileName:
|
if not fileName:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
with open(fileName, "r") as f:
|
with open(fileName, "rb") as f:
|
||||||
file_content = f.read() # type: Union[str, bytes]
|
file_content = f.read() # type: Union[str, bytes]
|
||||||
except (ValueError, IOError, os.error) as reason:
|
except (ValueError, IOError, os.error) as reason:
|
||||||
self.show_critical(_("Electrum was unable to open your transaction file") + "\n" + str(reason),
|
self.show_critical(_("Electrum was unable to open your transaction file") + "\n" + str(reason),
|
||||||
|
|
|
@ -47,8 +47,13 @@ class ScanQRTextEdit(ButtonsTextEdit, MessageBoxMixin):
|
||||||
if not fileName:
|
if not fileName:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
with open(fileName, "r") as f:
|
try:
|
||||||
data = f.read()
|
with open(fileName, "r") as f:
|
||||||
|
data = f.read()
|
||||||
|
except UnicodeError as e:
|
||||||
|
with open(fileName, "rb") as f:
|
||||||
|
data = f.read()
|
||||||
|
data = data.hex()
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
self.show_error(_('Error opening file') + ':\n' + repr(e))
|
self.show_error(_('Error opening file') + ':\n' + repr(e))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue