X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3204e4303148302d278036eebcfc8cb105cc97d7..2c6efebdedb5212749f1f6340118e31c22b260b1:/src/catalogue/ebook_utils.py?ds=inline diff --git a/src/catalogue/ebook_utils.py b/src/catalogue/ebook_utils.py index a61d18fb..f9bd6d37 100644 --- a/src/catalogue/ebook_utils.py +++ b/src/catalogue/ebook_utils.py @@ -1,4 +1,6 @@ -# -*- coding: utf-8 -*- +# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from io import BytesIO from catalogue.models import Book from librarian import DocProvider @@ -26,7 +28,7 @@ def serve_file(file_path, name, mime_type): response = HttpResponse(content_type=mime_type) response['Content-Disposition'] = 'attachment; filename=%s' % name - with open(file_path) as f: + with open(file_path, 'rb') as f: for chunk in read_chunks(f): response.write(chunk) return response