electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 87cff8e380003b1dfe2af1c8ed31d35a13bb1d05
parent 27917af2bffd8f79c3fe31db3ccd6d93fe9f01cf
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Thu,  3 Sep 2015 18:07:15 +0900

Check URI in "electrum" because of ambiguity

Diffstat:
Melectrum | 9+++++++++
Mgui/qt/__init__.py | 8+-------
2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/electrum b/electrum @@ -20,6 +20,7 @@ from decimal import Decimal import json import os +import re import sys import time import traceback @@ -481,6 +482,14 @@ if __name__ == '__main__': config = SimpleConfig(config_options) cmd_name = config.get('cmd') + # check uri + uri = config.get('url') + if uri: + # Assume a file is a payment request + if not os.path.exists(uri) and not re.match('^bitcoin:', uri): + print_stderr('unknown command:', uri) + sys.exit(1) + # initialize plugins. plugins = None if not is_android: diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py @@ -18,7 +18,6 @@ import sys import os -import re import signal try: @@ -230,15 +229,10 @@ class ElectrumGui: self.build_tray_menu() if uri: - print "URI: ", uri if os.path.exists(uri): # assume this is a payment request uri = "bitcoin:?r=file://"+ os.path.join(os.getcwd(), uri) - if re.match('^bitcoin:', uri): - w.pay_to_URI(uri) - else: - QMessageBox.critical(None, "Error", - _("bad bitcoin URI: %s") % uri) + w.pay_to_URI(uri) return w