Open swroberts opened 4 years ago
It is probably fixed in last version for Omeka v3, but can you check?
This still seems to be a problem.
Modifying put
to explicitly supply the mime type using the ContentType
parameter seems to work (at least for jpgs).
public function put($source, $storagePath): void
{
$bucket = $this->getBucketName();
$mime = mime_content_type($source);
$args = [
'Bucket' => $bucket,
'Key' => $storagePath,
'SourceFile' => $source,
'ACL' => 'public-read',
'ContentType' => $mime,
];
I know very little about PHP coding, but I can put this in a merge request if it's helpful.
When uploading files to s3, the content-type is not correctly read from the filename. As a result, each file is assigned "application/octet-stream", which affects the way files load in the browser, defaulting to downloading.
This thread on AWS Developer Forums (https://forums.aws.amazon.com/thread.jspa?threadID=86700) seems to suggest it can be solved with a slightly different method of passing arguments in the PUT command, but I don't know enough to test it out.
Thanks for all the hard work!