Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type Metadata Incorrect #1

Open
swroberts opened this issue Jan 27, 2020 · 3 comments
Open

Content-Type Metadata Incorrect #1

swroberts opened this issue Jan 27, 2020 · 3 comments
Assignees

Comments

@swroberts
Copy link

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!

@Daniel-KM Daniel-KM self-assigned this Mar 2, 2020
@Daniel-KM
Copy link
Owner

It is probably fixed in last version for Omeka v3, but can you check?

@wragge
Copy link
Contributor

wragge commented Apr 4, 2022

This still seems to be a problem.

@wragge
Copy link
Contributor

wragge commented Apr 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants