Add a Content-Disposition header to s3 downloads (#1047)

* Add a Content-Disposition header to s3 downloads so `wget` doesn't generate long invalid filenames.
This commit is contained in:
Kevin Chung
2019-06-30 12:02:52 -04:00
committed by GitHub
parent 2bca60790d
commit 03058716a0

View File

@@ -111,7 +111,14 @@ class S3Uploader(BaseUploader):
def download(self, filename):
url = self.s3.generate_presigned_url(
"get_object", Params={"Bucket": self.bucket, "Key": filename}
"get_object",
Params={
"Bucket": self.bucket,
"Key": filename,
"ResponseContentDisposition": "attachment; filename={}".format(
filename
),
},
)
return redirect(url)