Shouldn't redo URI encoding
authorMichael Wozniak <github@koh.ms>
Mon, 30 Jun 2014 15:10:50 +0000 (11:10 -0400)
committerMichael Wozniak <github@koh.ms>
Mon, 30 Jun 2014 15:10:50 +0000 (11:10 -0400)
lib/tests/test_util.py
lib/util.py

index 13f2abf..1fab17b 100644 (file)
@@ -43,7 +43,7 @@ class TestUtil(unittest.TestCase):
         self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.0003', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', 30000, '', '', '')
 
     def test_parse_URI_address_request_url(self):
-        self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?r=http://domain.tld/page?h%3D2a8628fc2fbe', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', 'http://domain.tld/page?h%3D2a8628fc2fbe')
+        self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?r=http://domain.tld/page?h%3D2a8628fc2fbe', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', 'http://domain.tld/page?h=2a8628fc2fbe')
 
     def test_parse_URI_ignore_args(self):
         self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?test=test', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', '')
@@ -52,7 +52,7 @@ class TestUtil(unittest.TestCase):
         self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.00004&label=electrum-test&message=electrum%20test&test=none&r=http://domain.tld/page', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', 4000, 'electrum-test', 'electrum test', 'http://domain.tld/page')
 
     def test_parse_URI_no_address_request_url(self):
-        self._do_test_parse_URI('bitcoin:?r=http://domain.tld/page?h%3D2a8628fc2fbe', '', '', '', '', 'http://domain.tld/page?h%3D2a8628fc2fbe')
+        self._do_test_parse_URI('bitcoin:?r=http://domain.tld/page?h%3D2a8628fc2fbe', '', '', '', '', 'http://domain.tld/page?h=2a8628fc2fbe')
 
     def test_parse_URI_invalid_address(self):
         self.assertRaises(AssertionError, parse_URI, 'bitcoin:invalidaddress')
index e734341..d796ae4 100644 (file)
@@ -159,7 +159,6 @@ def age(from_date, since_date = None, target_tz=None, include_seconds=False):
 
 def parse_URI(uri):
     import urlparse
-    import urllib
     import bitcoin
     from decimal import Decimal
 
@@ -193,7 +192,7 @@ def parse_URI(uri):
     if 'label' in pq:
         label = pq['label'][0]
     if 'r' in pq:
-        request_url = urllib.quote(pq['r'][0], '/:?')
+        request_url = pq['r'][0]
         
     if request_url != '':
         return address, amount, label, message, request_url