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

fix upload ContentType guess based on the key object file extension #232

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion inc/class-s3-uploads-stream-wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,16 @@ public function stream_flush()
$params = $this->getOptions(true);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 1 spaces after opening bracket; 0 found


Expected 1 spaces before closing bracket; 0 found

$params['Body'] = $this->body;

//Added by EveryUP Srl
$object_key = $params['Key'];
if ( pathinfo($object_key, PATHINFO_EXTENSION) === 'tmp' ) {
$object_key = substr($object_key, 0, -4);
}

// Attempt to guess the ContentType of the upload based on the
// file extension of the key. Added by Joe Hoyle
if (!isset($params['ContentType']) &&
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space after opening parenthesis is prohibited


Expected 1 space before "!"; 0 found


Expected 1 space after "!"; 0 found


Expected 1 spaces after opening bracket; 0 found


Expected 1 spaces before closing bracket; 0 found

($type = Psr7\mimetype_from_filename($params['Key']))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable "objectKey" is not in valid snake_case format


Expected 1 spaces after opening bracket; 0 found


Expected 1 spaces before closing bracket; 0 found


Variable "objectKey" is not in valid snake_case format

($type = Psr7\mimetype_from_filename($object_key))
) {
$params['ContentType'] = $type;
}
Expand Down