From 09154fdf20ec0cbfde43541a47803b86b655aec6 Mon Sep 17 00:00:00 2001 From: Michael Wozniak Date: Mon, 30 Jun 2014 11:10:50 -0400 Subject: [PATCH] Shouldn't redo URI encoding --- lib/tests/test_util.py | 4 ++-- lib/util.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/tests/test_util.py b/lib/tests/test_util.py index 13f2abf..1fab17b 100644 --- a/lib/tests/test_util.py +++ b/lib/tests/test_util.py @@ -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') diff --git a/lib/util.py b/lib/util.py index e734341..d796ae4 100644 --- a/lib/util.py +++ b/lib/util.py @@ -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 -- 1.7.1