]> git.0d.be Git - panikweb.git/commitdiff
avoid illegal character in podcast feed
authorFrédéric Péters <fpeters@0d.be>
Thu, 12 Nov 2020 10:14:36 +0000 (11:14 +0100)
committerFrédéric Péters <fpeters@0d.be>
Thu, 12 Nov 2020 10:14:36 +0000 (11:14 +0100)
panikweb/paniktags/templatetags/paniktags.py
panikweb/templates/feed/soundfile.html

index 814aaac8e27a05fbf0297845560b78ab89ce8ee1..f4183c9b990a762a014562107bf3d3961629ca84 100644 (file)
@@ -368,3 +368,9 @@ def as_absolute_url(url):
     if url.startswith('/'):
         url = settings.WEBSITE_BASE_URL + url.lstrip('/')
     return url
+
+
+@register.filter
+def xml_illegal_fix(text):
+    # django.utils.xmlutils.UnserializableContentError: Control characters are not supported in XML 1.0
+    return text.replace('\x02', ' ')
index 866e6be7221865bfaa2e01f42e8d8b3d0eacaecb..3069af581c492c61fd4d522547c0e7f49accd155 100644 (file)
@@ -10,5 +10,5 @@
 {% endif %}
 
 {% autoescape off %}
-{{ obj.episode.text|set_absolute_urls }}
+{{ obj.episode.text|xml_illegal_fix|set_absolute_urls }}
 {% endautoescape %}