Applied a patch from production to trunk.

- Legacy-Id: 13214
This commit is contained in:
Henrik Levkowetz 2017-04-14 12:09:46 +00:00
parent 1f2044bd83
commit 128be4b2e8

View file

@ -419,13 +419,11 @@ class DocumentInfo(models.Model):
try:
with open(path, 'rb') as file:
raw = file.read()
except IOError as e:
import sys
logger.error("IOError for %s: %s", path, e, exc_info=sys.exc_info())
except IOError:
return None
try:
text = raw.decode('utf-8')
except UnicodeDecodeError as e:
except UnicodeDecodeError:
text = raw.decode('latin-1')
#
return text