From ff320eb011041805bb1da218fbebcd1bace984a1 Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Dec 04 2016 11:41:14 +0000 Subject: Fix attachment name encoding error Whenever an attachment has a non ascii character, importer exits with an encoding error. This fixes the problem by converting the get_secure_filename argument to unicode. --- diff --git a/pagure_importer/utils/git.py b/pagure_importer/utils/git.py index 6884178..c337325 100644 --- a/pagure_importer/utils/git.py +++ b/pagure_importer/utils/git.py @@ -14,9 +14,9 @@ import werkzeug def get_secure_filename(attachment, filename): ''' Hashes the file name, same as pagure ''' - attach = str(attachment).encode('utf-8') + attach = str(attachment) filename = '%s-%s' % (hashlib.sha256(attach).hexdigest(), - werkzeug.secure_filename(str(filename))) + werkzeug.secure_filename(unicode(filename))) return filename