Skip to content

Commit 989c087

Browse files
committed
patch of copy
1 parent 7ef5390 commit 989c087

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/Qcloud/Cos/Copy.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ public function uploadParts($uploadId) {
9292
'PartNumberMarker' => $marker,
9393
'MaxParts' => 1000,
9494
'UploadId' => $uploadId));
95-
foreach ($rt['Parts'] as $part) {
96-
$part = array('PartNumber' => $finishedNum, 'ETag' => $part['ETag']);
97-
$this->parts[$finishedNum] = $part;
98-
$finishedNum++;
95+
if (!empty($rt['Parts'])) {
96+
foreach ($rt['Parts'] as $part) {
97+
$part = array('PartNumber' => $finishedNum, 'ETag' => $part['ETag']);
98+
$this->parts[$finishedNum] = $part;
99+
$finishedNum++;
100+
}
99101
}
100102
$marker = $rt['NextPartNumberMarker'];
101103
if (!$rt['IsTruncated']) {

src/Qcloud/Cos/Tests/Test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected function setUp()
1717
'appId' => getenv('COS_APPID'),
1818
'secretId' => getenv('COS_KEY'),
1919
'secretKey' => getenv('COS_SECRET'))));
20-
sleep(10);
20+
sleep(5);
2121
}
2222

2323
protected function tearDown()
@@ -789,9 +789,9 @@ public function testCopyBigFile()
789789
$this->cosClient->Copy($bucket = $this->bucket,
790790
$key = 'test10G',
791791
$copysource = 'lewzylu01-1251668577.cos.ap-guangzhou.myqcloud.com/test10G');
792-
$rt = $this->cosClient->headObject($bucket = $this->bucket,
793-
$key = 'test10G');
794-
assertTrue(true, $rt['ContentLength'] == 1024 * 1024 * 1024);
792+
$rt = $this->cosClient->headObject(array('Bucket' => $this->$bucket,
793+
'Key' => 'test10G'));
794+
assertTrue(true, $rt['ContentLength'] == 10485760000);
795795

796796
} catch (ServiceResponseException $e) {
797797
$this->assertFalse(true, $e);

0 commit comments

Comments
 (0)