Skip to content

Commit e0e0b86

Browse files
lewzylulewzylu
andauthored
fix signature with urlencode (#164)
Co-authored-by: lewzylu <[email protected]>
1 parent 8654f9d commit e0e0b86

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/Qcloud/Cos/Signature.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public function createAuthorization( RequestInterface $request, $expires = '+30
5454
foreach ( explode( '&', $request->getUri()->getQuery() ) as $query ) {
5555
if (!empty($query)) {
5656
$tmpquery = explode( '=', $query );
57-
$key = strtolower( urlencode( $tmpquery[0] ) );
57+
$key = strtolower( $tmpquery[0] );
5858
if (count($tmpquery) >= 2) {
59-
$value = urlencode( $tmpquery[1] );
59+
$value = $tmpquery[1];
6060
} else {
6161
$value = "";
6262
}

src/Qcloud/Cos/Tests/COSTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,23 @@ public function testGetBucketEmpty()
554554
}
555555
}
556556

557+
/*
558+
* get bucket, prefix为中文
559+
* 200
560+
*/
561+
public function testGetBucketWithChinese()
562+
{
563+
try {
564+
$this->cosClient->ListObjects(array(
565+
'Bucket' => $this->bucket,
566+
'Prefix' => '中文',
567+
'Delimiter' => '/'));
568+
} catch (ServiceResponseException $e) {
569+
print $e;
570+
$this->assertFalse(TRUE);
571+
}
572+
}
573+
557574
/*
558575
* get bucket,bucket不存在
559576
* NoSuchBucket
@@ -1009,7 +1026,7 @@ public function testPutObjectMeta() {
10091026
$key = '你好.txt';
10101027
$meta = array(
10111028
'test' => str_repeat('a', 1 * 1024),
1012-
'test-meta' => 'qwe-23ds-ad-xcz.asd.*qweqw'
1029+
'test-meta' => '中文qwe-23ds-ad-xcz.asd.*qweqw'
10131030
);
10141031
$this->cosClient->putObject(array(
10151032
'Bucket' => $this->bucket,

0 commit comments

Comments
 (0)