Skip to content

Commit

Permalink
fix problem with empty tarball name and boto3 s3 storage
Browse files Browse the repository at this point in the history
  • Loading branch information
pacahon committed Aug 29, 2016
1 parent 9bab10a commit 70c00db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dbbackup/management/commands/mediabackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import tarfile

from django.core.files import File
from django.core.management.base import CommandError
from django.core.files.storage import get_storage_class

Expand Down Expand Up @@ -88,6 +89,14 @@ def backup_mediafiles(self):

tarball = self._create_tar(filename)

# ``django.core.files.storage.Storage.save`` method waiting for
# an instance (or a subclass) of django.core.files.File
# File-like objects also works, but with empty name we have a bug
# in boto3.S3Boto3Storage, which leads to botocore internals.
# See https://github.com/boto/botocore/issues/1022
# TODO: remove, when problem will be solved
tarball = File(tarball, name=filename)

if self.encrypt:
encrypted_file = utils.encrypt_file(tarball, filename)
tarball, filename = encrypted_file
Expand Down

0 comments on commit 70c00db

Please sign in to comment.