Skip to content

Commit

Permalink
* Minor fixes so that the content disposition is quoted.
Browse files Browse the repository at this point in the history
* Use the correct S3 command to upload a document.
  • Loading branch information
bgroff committed Jun 18, 2018
1 parent 36da813 commit b74d678
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions django_kala/django_kala/platforms/aws/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@ def get_document_url(self, document):
ClientMethod='get_object',
Params={
'Bucket': settings.S3_STORAGE_BUCKET,
'Key': 'media/documents/{0}'.format(document.uuid),
'Key': 'media/documents/"{0}"'.format(document.uuid),
'ResponseContentDisposition': 'attachment; filename={0}'.format(document.name),
}
)
return url

def upload_document(self, content, key):
s3 = boto3.client('s3')
s3.put(
s3.put_object(
ACL='private',
Body=content,
Bucket=settings.S3_STORAGE_BUCKET,
Key='media/documents/{0}'.format(key),
ServerSideEncryption='AES256'
)


def upload_export(self, export_path):
key = 'exports/{0}'.format(uuid4())

Expand Down

0 comments on commit b74d678

Please sign in to comment.