X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/56145861cf5fa01c5fbb429d40242e0a16189ed1..30423c0a921a37cc2213e83309d5abe04399ba15:/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)