diff --git a/CHANGELOG.md b/CHANGELOG.md index c8072e9ba..daf8aaa3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ at anytime. * Fixed incorrect formatting of "amount" fields * Fixed handling of SIGINT, SIGTERM. * Fixed shutdown sequence + * Fix error when resolving an integer + * ### Deprecated * The API will no longer be served at the /lbryapi path. It will now be at the root. @@ -80,7 +82,7 @@ at anytime. ### Fixed * Fixed timeout behaviour when calling API command get * Fixed https://github.com/lbryio/lbry/issues/765 - + ### Removed * Removed stream_info_cache.json from daemon.py diff --git a/lbrynet/daemon/DaemonCLI.py b/lbrynet/daemon/DaemonCLI.py index 906afb96b..d13ab4fe8 100644 --- a/lbrynet/daemon/DaemonCLI.py +++ b/lbrynet/daemon/DaemonCLI.py @@ -28,12 +28,12 @@ def set_flag_vals(flag_names, parsed_args): elif key.startswith("--"): if remove_brackets(key[2:]) not in kwargs: k = remove_brackets(key[2:]) - kwargs[k] = guess_type(arg) elif key in flag_names: if remove_brackets(flag_names[key]) not in kwargs: - kwargs[remove_brackets(flag_names[key])] = guess_type(arg) + k = remove_brackets(flag_names[key]) elif remove_brackets(key) not in kwargs: - kwargs[remove_brackets(key)] = guess_type(arg) + k = remove_brackets(key) + kwargs[k] = guess_type(arg, k) return kwargs @@ -130,7 +130,7 @@ def main(): return 1 -def guess_type(x): +def guess_type(x, key=None): if not isinstance(x, (unicode, str)): return x if x in ('true', 'True', 'TRUE'): @@ -143,6 +143,8 @@ def guess_type(x): except ValueError: # not a float pass + if key == "uri": + return x try: return int(x) except ValueError: diff --git a/tests/unit/lbrynet_daemon/test_DaemonCLI.py b/tests/unit/lbrynet_daemon/test_DaemonCLI.py index 1ee330d42..294ce1410 100644 --- a/tests/unit/lbrynet_daemon/test_DaemonCLI.py +++ b/tests/unit/lbrynet_daemon/test_DaemonCLI.py @@ -7,6 +7,7 @@ class DaemonCLITests(unittest.TestCase): self.assertEqual('0.3.8', DaemonCLI.guess_type('0.3.8')) self.assertEqual(0.3, DaemonCLI.guess_type('0.3')) self.assertEqual(3, DaemonCLI.guess_type('3')) + self.assertEqual('3', DaemonCLI.guess_type('3', key="uri")) self.assertEqual('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==', DaemonCLI.guess_type('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==')) self.assertEqual(0.3, DaemonCLI.guess_type('0.3')) self.assertEqual(True, DaemonCLI.guess_type('TRUE')) @@ -15,4 +16,3 @@ class DaemonCLITests(unittest.TestCase): self.assertEqual(False, DaemonCLI.guess_type('FALSE')) self.assertEqual(False, DaemonCLI.guess_type('false')) self.assertEqual(False, DaemonCLI.guess_type('False')) -