Skip to content

Commit 9aa2c59

Browse files
committed
pre-release 2.5.0
- 万象支持病毒检测、人声分离任务接口 - 万象转码任务支持多个水印参数/多任务接口/查询接口/列表接口 - 修复签名长期存在的bug - 修复copy接口404问题,copyObject示例添加注释 - 审核接口增加仅支持https的说明
1 parent 4322310 commit 9aa2c59

File tree

8 files changed

+349
-339
lines changed

8 files changed

+349
-339
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
cos-php-sdk-v5 Upgrade Guide
22
====================
3+
2.4.4 to 2.5.0
4+
---------
5+
- 万象支持病毒检测、人声分离任务接口
6+
- 万象转码任务支持多个水印参数/多任务接口/查询接口/列表接口
7+
- 修复签名长期存在的bug
8+
- 修复copy接口404问题,copyObject示例添加注释
9+
- 审核接口增加仅支持https的说明
10+
311
2.4.3 to 2.4.4
412
---------
513
- 修复图片水印签名问题

sample/copyObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
$result = $cosClient->copyObject(array(
1717
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
1818
'Key' => 'exampleobject',
19-
'CopySource' => 'examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject',
19+
'CopySource' => urlencode('examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject'), //请注意这里需要urlencode,防止因特殊字符产生的400或404错误
2020
'MetadataDirective' => 'Replaced',
2121
));
2222
// 请求成功

sample/createMediaTranscodeJobs.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
require dirname(__FILE__) . '/../vendor/autoload.php';
44

5-
$secretId = getenv("SECRETID"); //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6-
$secretKey = getenv("SECRETKEY"); //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7-
$region = "ap-chongqing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
88
$cosClient = new Qcloud\Cos\Client(
99
array(
1010
'region' => $region,
@@ -15,7 +15,7 @@
1515
try {
1616
// 多任务接口
1717
$result = $cosClient->CreateMediaJobs(array(
18-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
1919
'Tag' => 'Transcode',
2020
'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca',
2121
'CallBack' => '',
@@ -27,7 +27,7 @@
2727
'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c',
2828
'Output' => array(
2929
'Region' => $region,
30-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
30+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
3131
'Object' => 'video01.mp4',
3232
),
3333
'WatermarkTemplateId' => array(
@@ -51,7 +51,7 @@
5151
// 单任务接口
5252
// start --------------- 使用模版 ----------------- //
5353
$result = $cosClient->createMediaTranscodeJobs(array(
54-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
54+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
5555
'Tag' => 'Transcode',
5656
'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca',
5757
'Input' => array(
@@ -61,7 +61,7 @@
6161
'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c',
6262
'Output' => array(
6363
'Region' => $region,
64-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
64+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
6565
'Object' => 'video02.mp4',
6666
),
6767
'Watermark' => arrray(
@@ -97,11 +97,11 @@
9797
),
9898
));
9999
$result = $cosClient->DescribeMediaJob(array(
100-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
100+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
101101
'Key' => 'j20f7a6be6c5511eca253f3ee9d4082e0',
102102
));
103103
$result = $cosClient->DescribeMediaJobs(array(
104-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
104+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
105105
'Tag' => 'Transcode',
106106
'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca',
107107
));

src/Client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
* @method object CreateMediaTranscodeJobs(array $args) 媒体转码
9999
* @method object CreateMediaJobs(array $args) 媒体任务
100100
* @method object DescribeMediaJob(array $args) 媒体任务
101-
* @method object DescribeMediaJobs(array $args) 媒体任务
101+
* @method object DescribeMediaJobs(array $args)
102102
* @method object CreateMediaSnapshotJobs(array $args) 媒体截图
103103
* @method object CreateMediaConcatJobs(array $args) 媒体拼接
104104
* @method object DetectAudio(array $args) 音频审核
@@ -114,15 +114,15 @@
114114
* @method object GetDescribeDocProcessJobs(array $args) 拉取符合条件的文档转码任务
115115
* @method object DetectImage(array $args) 图片审核
116116
* @method object DetectImages(array $args) 图片审核-批量
117-
* @method object GetDetectImageResult(array $args) 主动获取图片审核结果
118117
* @method object DetectVirus(array $args) 云查毒
119118
* @method object GetDetectVirusResult(array $args) 查询病毒检测任务结果
119+
* @method object GetDetectImageResult(array $args) 主动获取图片审核结果
120120
* @method object CreateMediaVoiceSeparateJobs(array $args) 提交人声分离任务
121121
* @method object DescribeMediaVoiceSeparateJob(array $args) 查询指定的人声分离任务
122122
* @see \Qcloud\Cos\Service::getService()
123123
*/
124124
class Client extends GuzzleClient {
125-
const VERSION = '2.4.4';
125+
const VERSION = '2.5.0';
126126

127127
public $httpClient;
128128

@@ -412,7 +412,7 @@ public function copy($bucket, $key, $copySource, $options = array()) {
412412
$rt = $this->copyObject(array(
413413
'Bucket' => $bucket,
414414
'Key' => $key,
415-
'CopySource' => "{$copySource['Bucket']}.cos.{$copySource['Region']}.myqcloud.com/{$copySource['Key']}?versionId={$copySource['VersionId']}",
415+
'CopySource' => "{$copySource['Bucket']}.cos.{$copySource['Region']}.myqcloud.com/". urlencode("{$copySource['Key']}")."?versionId={$copySource['VersionId']}",
416416
) + $options
417417
);
418418
return $rt;

src/CommandToRequestTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function queryStringTransformer( CommandInterface $command, $request ) {
151151
foreach ( $params as $key => $value ) {
152152
$uri = $request->getUri();
153153
$query = $uri->getQuery();
154-
$uri = $uri->withQuery($query. "&" . $key . "=" . $value );
154+
$uri = $uri->withQuery($query. "&" . urlencode($key) . "=" . $value );
155155
$request = $request->withUri( $uri );
156156
}
157157
}

src/Signature.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public function createAuthorization( RequestInterface $request, $expires = '+30
7474
foreach ( explode( '&', $request->getUri()->getQuery() ) as $query ) {
7575
if (!empty($query)) {
7676
$tmpquery = explode( '=', $query );
77-
$key = strtolower( $tmpquery[0] );
77+
//为了保证CI的key中有=号的情况也能正常通过,ci在这层之前已经encode了,这里需要拆开重新encode,防止上方explode拆错
78+
$key = strtolower( rawurlencode(urldecode($tmpquery[0])) );
7879
if (count($tmpquery) >= 2) {
7980
$value = $tmpquery[1];
8081
} else {

0 commit comments

Comments
 (0)