From 9017328698e699bea75e96dc30b07f7146158a24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Mon, 26 Oct 2015 00:28:29 +0100 Subject: [PATCH] Add an extra strip() to work around tostring issue In cases like this xml code: "OpenKeychain" "Encrypt" tostring() returns trailing whitespaces (including newlines). Which aren't removed until the very end, after we try to remove enclosing quotes. So strip right after tostring() too, since we never really care about whitespaces anyway. --- fdroidserver/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 47db0101..db2e0f09 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -914,7 +914,8 @@ def retrieve_string(app_dir, string, xmlfiles=None): def element_content(element): if element.text is None: return "" - return XMLElementTree.tostring(element, encoding='utf-8', method='text') + s = XMLElementTree.tostring(element, encoding='utf-8', method='text') + return s.strip() for path in xmlfiles: if not os.path.isfile(path): -- 2.30.2