contrib/deluge/3079.patch

34 lines
946 B
Diff

From 6d14be18b09e83cea4c049f6f3e7c9771b04eda6 Mon Sep 17 00:00:00 2001
From: Calum Lind <calumlind+deluge@gmail.com>
Date: Wed, 28 Jun 2017 10:32:35 +0100
Subject: [#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.
---
deluge/config.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/deluge/config.py b/deluge/config.py
index 4009513..c893bd8 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
--
cgit v1.1