[tor-commits] [bridgedb/develop] Only parse PT args if there is an arg present.

isis at torproject.org isis at torproject.org
Thu Feb 19 02:21:14 UTC 2015


commit a7da6a642290d1ce2c9eb2d8545dc6a30b1d170c
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Dec 24 08:55:15 2014 +0000

    Only parse PT args if there is an arg present.
---
 lib/bridgedb/bridges.py |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/bridgedb/bridges.py b/lib/bridgedb/bridges.py
index 4968988..735c603 100644
--- a/lib/bridgedb/bridges.py
+++ b/lib/bridgedb/bridges.py
@@ -312,13 +312,14 @@ class PluggableTransport(BridgeAddressBase):
         allArguments = ','.join(argumentList)
 
         for arg in allArguments.split(','):
-            try:
-                key, value = arg.split('=')
-            except ValueError:
-                logging.warn("  Couldn't parse K=V from PT arg: %r" % arg)
-            else:
-                logging.debug("  Parsed PT Argument: %s: %s" % (key, value))
-                argDict[key] = value
+            if arg:  # It might be an empty string
+                try:
+                    key, value = arg.split('=')
+                except ValueError:
+                    logging.warn("  Couldn't parse K=V from PT arg: %r" % arg)
+                else:
+                    logging.debug("  Parsed PT Argument: %s: %s" % (key, value))
+                    argDict[key] = value
 
         return argDict
 





More information about the tor-commits mailing list