From 3ed3f705061fe0ffff7ed3ab0cd09cbffdf5390f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Thu, 4 Jun 2015 15:58:03 +0200 Subject: [PATCH] Encode strings before hashing --- mygpo/data/feeddownloader.py | 2 +- mygpo/web/logo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mygpo/data/feeddownloader.py b/mygpo/data/feeddownloader.py index 4098a676..9e8110b9 100755 --- a/mygpo/data/feeddownloader.py +++ b/mygpo/data/feeddownloader.py @@ -317,7 +317,7 @@ def _save_podcast_logo(cover_art): return try: - image_sha1 = hashlib.sha1(cover_art).hexdigest() + image_sha1 = hashlib.sha1(cover_art.encode('utf-8')).hexdigest() prefix = CoverArt.get_prefix(image_sha1) filename = CoverArt.get_original(prefix, image_sha1) diff --git a/mygpo/web/logo.py b/mygpo/web/logo.py index c9e4d0af..71098486 100644 --- a/mygpo/web/logo.py +++ b/mygpo/web/logo.py @@ -154,7 +154,7 @@ def get_logo_url(podcast, size): """ Return the logo URL for the podcast """ if podcast.logo_url: - filename = hashlib.sha1(podcast.logo_url).hexdigest() + filename = hashlib.sha1(podcast.logo_url.encode('utf-8')).hexdigest() else: filename = 'podcast-%d.png' % (hash(podcast.title) % 5, ) -- 2.11.4.GIT