From c8ab6a06fb6a8117927b6c4a7235a0caa417f1f8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 19 Sep 2013 23:39:15 +0200 Subject: [PATCH] ASCII encode md5 string. closes #2167 --- couchpotato/core/_base/_core/main.py | 2 +- couchpotato/core/helpers/variable.py | 2 +- couchpotato/core/media/movie/searcher/main.py | 2 +- couchpotato/core/plugins/base.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/_base/_core/main.py b/couchpotato/core/_base/_core/main.py index 9647d959..803ac5a3 100644 --- a/couchpotato/core/_base/_core/main.py +++ b/couchpotato/core/_base/_core/main.py @@ -56,7 +56,7 @@ class Core(Plugin): self.signalHandler() def md5Password(self, value): - return md5(value.encode(Env.get('encoding'))) if value else '' + return md5(value) if value else '' def checkApikey(self, value): return value if value and len(value) > 3 else uuid4().hex diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 2b288740..1e7fc837 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -101,7 +101,7 @@ def flattenList(l): return l def md5(text): - return hashlib.md5(text).hexdigest() + return hashlib.md5(ss(text)).hexdigest() def sha1(text): return hashlib.sha1(text).hexdigest() diff --git a/couchpotato/core/media/movie/searcher/main.py b/couchpotato/core/media/movie/searcher/main.py index a8fca185..b08e7532 100644 --- a/couchpotato/core/media/movie/searcher/main.py +++ b/couchpotato/core/media/movie/searcher/main.py @@ -1,7 +1,7 @@ from couchpotato import get_session from couchpotato.api import addApiView from couchpotato.core.event import addEvent, fireEvent, fireEventAsync -from couchpotato.core.helpers.encoding import simplifyString, toUnicode +from couchpotato.core.helpers.encoding import simplifyString, toUnicode, ss from couchpotato.core.helpers.variable import md5, getTitle, splitString, \ possibleTitles, getImdb from couchpotato.core.logger import CPLog diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index b9ec0c06..ce7c1b49 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -259,7 +259,7 @@ class Plugin(object): def getCache(self, cache_key, url = None, **kwargs): - cache_key_md5 = md5(ss(cache_key)) + cache_key_md5 = md5(cache_key) cache = Env.get('cache').get(cache_key_md5) if cache: if not Env.get('dev'): log.debug('Getting cache %s', cache_key) @@ -284,7 +284,7 @@ class Plugin(object): return '' def setCache(self, cache_key, value, timeout = 300): - cache_key_md5 = md5(ss(cache_key)) + cache_key_md5 = md5(cache_key) log.debug('Setting cache %s', cache_key) Env.get('cache').set(cache_key_md5, value, timeout) return value