Skip to content

Commit

Permalink
Avoid file seek when saving extracted files
Browse files Browse the repository at this point in the history
  • Loading branch information
shadinaif authored and regisb committed Oct 14, 2020
1 parent 309617a commit 0109b45
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion openedxscorm/scormxblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import zipfile

from django.core.files import File
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.template import Context, Template
from django.utils import timezone
Expand Down Expand Up @@ -277,7 +278,8 @@ def extract_package(self, package_file):
os.path.relpath(zipinfo.filename, root_path),
)
self.storage.save(
dest_path, scorm_zipfile.open(zipinfo.filename),
dest_path,
ContentFile(scorm_zipfile.read(zipinfo.filename)),
)

@property
Expand Down

0 comments on commit 0109b45

Please sign in to comment.