Fix #5500 UnicodeEncodeError in atom feed
authorAndrew Browning <ayleph@thisshitistemp.com>
Tue, 14 Feb 2017 06:01:48 +0000 (01:01 -0500)
committerAndrew Browning <ayleph@thisshitistemp.com>
Tue, 14 Feb 2017 06:03:25 +0000 (01:03 -0500)
This simple fix allows unicode strings in the atom feed thumb and
description fields by forcing the entire atom content string to
unicode.

mediagoblin/listings/views.py
mediagoblin/user_pages/views.py

index fa6b5ba779be9af4c559561ece6432d057becac9..6e1528ca210d208a418a44ac98304770ba8aea9e 100644 (file)
@@ -109,7 +109,7 @@ def atom_feed(request):
         # Include a thumbnail image in content.
         file_urls = get_media_file_paths(entry.media_files, request.urlgen)
         if 'thumb' in file_urls:
-            content = '<img src="{thumb}" alt='' /> {desc}'.format(
+            content = u'<img src="{thumb}" alt='' /> {desc}'.format(
                 thumb=file_urls['thumb'], desc=entry.description_html)
         else:
             content = entry.description_html
index eaae1bd74eb1ad560d0f1b581c30676f311311a8..484d27cd9ff42c3c5567e73c6edb26120aead5ab 100644 (file)
@@ -574,7 +574,7 @@ def atom_feed(request):
         # Include a thumbnail image in content.
         file_urls = get_media_file_paths(entry.media_files, request.urlgen)
         if 'thumb' in file_urls:
-            content = '<img src="{thumb}" alt='' /> {desc}'.format(
+            content = u'<img src="{thumb}" alt='' /> {desc}'.format(
                 thumb=file_urls['thumb'], desc=entry.description_html)
         else:
             content = entry.description_html