Check URI in "electrum" because of ambiguity

This commit is contained in:
Neil Booth 2015-09-03 18:07:15 +09:00
parent 27917af2bf
commit 87cff8e380
2 changed files with 10 additions and 7 deletions

View File

@ -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:

View File

@ -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