django-s3-file-field icon indicating copy to clipboard operation
django-s3-file-field copied to clipboard

Ensure content type and filename information is appropriately passed to storage

Open brianhelba opened this issue 4 years ago • 3 comments

Ideally, this would result in MinIO / S3 automatically setting the Content-Type and Content-Disposition (the filename portion) headers for every download.

This probably involves setting the appropriate S3-Object metadata when the object is first created. The particular headers should be empirically verified. This may be a starting point for S3 headers.

The original information about the filename and content type should probably come from the client, but the server may also be able to infer content type (see #52).

This was originally reported in #197.

brianhelba avatar Jan 21 '21 20:01 brianhelba

I can confirm that setting Content-Type and Content-Disposition will result in those values being set as HTTP headers on download. The AWS multipart upload docs indicate that those metadata fields can be specified as headers when initializing a multipart upload. The server can make informed guesses about the correct values and also accept values from the client.

dchiquito avatar Feb 22 '21 18:02 dchiquito

@dchiquito Just to clarify, you tested these headers on both AWS S3 and MinIO?

brianhelba avatar Feb 27 '21 20:02 brianhelba

Indeed I did.

dchiquito avatar Mar 02 '21 23:03 dchiquito