From b3b33c902a7eb9fa17473ce018da802eafdce5d1 Mon Sep 17 00:00:00 2001
From: Filip Gurbal <filip.gurbal@adaptiware.com>
Date: Mon, 4 Nov 2019 11:30:54 +0100
Subject: [PATCH] Fix libraries sync when jellyfin library has apostrophes in
 name

---
 resources/lib/helper/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/resources/lib/helper/utils.py b/resources/lib/helper/utils.py
index 95c99c7c..19411b1b 100644
--- a/resources/lib/helper/utils.py
+++ b/resources/lib/helper/utils.py
@@ -293,7 +293,11 @@ def indent(elem, level=0):
 def write_xml(content, file):
     with open(file, 'w') as infile:
 
-        content = content.replace("'", '"')
+        def replace_apostrophes(match):
+            return match.group(0).replace("'", '"')
+
+        content = re.sub("<(.*?)>", replace_apostrophes, content)
+
         content = content.replace('?>', ' standalone="yes" ?>', 1)
         infile.write(content)