Skip to content
Open
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
15 changes: 4 additions & 11 deletions src/MultipartUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MultipartUpload {
const MIN_PART_SIZE = 1048576;
const MAX_PART_SIZE = 5368709120;
const DEFAULT_PART_SIZE = 5242880;
const MAX_PARTS = 10000;
const MAX_PARTS = 10000;

private $client;
private $options;
Expand Down Expand Up @@ -89,7 +89,7 @@ public function uploadParts($uploadId) {
'Body' => $body,
'ContentMD5' => $this->needMd5
);
if ($this->needMd5 == false) {
if (!$this->needMd5) {
unset($params["ContentMD5"]);
}
if (!isset($this->parts[$partNumber])) {
Expand All @@ -106,15 +106,8 @@ public function uploadParts($uploadId) {
$index = $index + 1;
$partNumber = $this->partNumberList[$index]['PartNumber'];
$partSize = $this->partNumberList[$index]['PartSize'];

//兼容两种写法,防止index为undefined
if (array_key_exists('etag', $response->getHeaders())) {
$etag = $response->getHeaders()["etag"][0];
}

if (array_key_exists('ETag', $response->getHeaders())) {
$etag = $response->getHeaders()["ETag"][0];
}
/** @var \GuzzleHttp\Psr7\Response $response */
$etag = $response->getHeaderLine('ETag');
$part = array('PartNumber' => $partNumber, 'ETag' => $etag);
$this->parts[$partNumber] = $part;
$this->uploadedSize += $partSize;
Expand Down