X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/56145861cf5fa01c5fbb429d40242e0a16189ed1..040285e94b385dd57a003a4fe5b693c299fe921b:/src/dvcs/storage.py diff --git a/src/dvcs/storage.py b/src/dvcs/storage.py index 91f78e60..a57d759f 100755 --- a/src/dvcs/storage.py +++ b/src/dvcs/storage.py @@ -3,6 +3,7 @@ from zlib import compress, decompress from django.core.files.base import ContentFile, File from django.core.files.storage import FileSystemStorage from django.utils.deconstruct import deconstructible +from django.utils.encoding import force_bytes @deconstructible @@ -15,6 +16,7 @@ class GzipFileSystemStorage(FileSystemStorage): return ContentFile(decompress(text)) def _save(self, name, content): - content = ContentFile(compress(content.read())) + data = force_bytes(content.read()) + content = ContentFile(compress(data)) return super(GzipFileSystemStorage, self)._save(name, content)