Skip to content

Commit

Permalink
Corrected some response handling in the S3 multipart upload abstraction.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremeamia committed May 2, 2015
1 parent 9d3f132 commit da120ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php
Expand Up @@ -90,9 +90,9 @@ protected function transfer()
/** @var \Guzzle\Service\Command\OperationCommand $command */
foreach ($this->client->execute($commands) as $command) {
$this->state->addPart(UploadPart::fromArray(array(
'PartNumber' => count($this->state) + 1,
'PartNumber' => $command['PartNumber'],
'ETag' => $command->getResponse()->getEtag(),
'Size' => (int) $command->getResponse()->getContentLength(),
'Size' => (int) $command->getRequest()->getBody()->getContentLength(),
'LastModified' => gmdate(DateFormat::RFC2822)
)));
$eventData['command'] = $command;
Expand Down
2 changes: 1 addition & 1 deletion src/Aws/S3/Model/MultipartUpload/SerialTransfer.php
Expand Up @@ -73,7 +73,7 @@ protected function transfer()
$response = $command->getResponse();

$this->state->addPart(UploadPart::fromArray(array(
'PartNumber' => count($this->state) + 1,
'PartNumber' => $command['PartNumber'],
'ETag' => $response->getEtag(),
'Size' => $body->getContentLength(),
'LastModified' => gmdate(DateFormat::RFC2822)
Expand Down
4 changes: 2 additions & 2 deletions tests/Aws/Tests/S3/Integration/IntegrationTest.php
Expand Up @@ -359,7 +359,7 @@ public function testPutObjectAcl()
));
$result = $command->execute();
$this->assertContains('Grantee', (string) $command->getRequest()->getBody());
$this->assertEquals(array('RequestId'), array_keys($result->toArray()));
$this->assertArrayHasKey('RequestId', array_keys($result->toArray()));
// Ensure that the RequestId model value is being populated correctly
$this->assertEquals((string) $command->getResponse()->getHeader('x-amz-request-id'), $result['RequestId']);
}
Expand Down Expand Up @@ -503,7 +503,7 @@ public function testMultipartUploads()
'UploadId' => $uploadId
));
$result = $command->execute();
$this->assertEquals(array('RequestId'), array_keys($result->toArray()));
$this->assertArrayHasKey('RequestId', array_keys($result->toArray()));
}

/**
Expand Down

0 comments on commit da120ab

Please sign in to comment.