Skip to content

Commit 68ca62b

Browse files
committed
hashlib.md5 doesn't support unicode, use str instead
1 parent 5e24b7d commit 68ca62b

3 files changed

Lines changed: 1970 additions & 1 deletion

File tree

goose/images/ImageUtils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import os
2525
import urllib2
2626
from PIL import Image
27+
from goose.utils.encoding import smart_str
2728
from goose.images.ImageDetails import ImageDetails
2829
from goose.images.ImageExtractor import LocallyStoredImage
2930

@@ -101,7 +102,7 @@ def writeEntityContentsToDisk(self, entity, linkhash, imageSrc, config):
101102

102103
@classmethod
103104
def getLocalFileName(self, linkhash, imageSrc, config):
104-
imageHash = hashlib.md5(imageSrc).hexdigest()
105+
imageHash = hashlib.md5(smart_str(imageSrc)).hexdigest()
105106
return config.localStoragePath + "/" + linkhash + "_py_" + imageHash
106107

107108
@classmethod

0 commit comments

Comments
 (0)