summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-06-28 10:32:35 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2017-06-28 10:39:20 +0100
commit6d14be18b09e83cea4c049f6f3e7c9771b04eda6 (patch)
tree86e16a28e3700ecbd19829d7387edbdf446be502
parent65fac156eb7d6d2e95bff8ea458753ca5fc5f6d4 (diff)
downloaddeluge-6d14be18b09e83cea4c049f6f3e7c9771b04eda6.tar.gz
deluge-6d14be18b09e83cea4c049f6f3e7c9771b04eda6.tar.bz2
deluge-6d14be18b09e83cea4c049f6f3e7c9771b04eda6.zip
[#3079] Fix config parsing for json objects
* If a curly brace was used in a string then find_json_ojects would fail to find objects correctly. To fix this ignore double-quoted entries.
-rw-r--r--deluge/config.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/deluge/config.py b/deluge/config.py
index 40095139e..c893bd83b 100644
--- a/deluge/config.py
+++ b/deluge/config.py
@@ -111,8 +111,13 @@ def find_json_objects(s):
if start < 0:
return []
+ quoted = False
for index, c in enumerate(s[offset:]):
- if c == "{":
+ if c == '"':
+ quoted = not quoted
+ elif quoted:
+ continue
+ elif c == "{":
opens += 1
elif c == "}":
opens -= 1