Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Qcloud/Cos/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($cosConfig) {
$this->rawCosConfig = $cosConfig;
$this->cosConfig['schema'] = isset($cosConfig['schema']) ? $cosConfig['schema'] : 'http';
$this->cosConfig['endpoint'] = isset($cosConfig['endpoint']) ? $cosConfig['endpoint'] : null;
$this->cosConfig['region'] = isset($regionmap[$cosConfig['region']]) ? region_map($cosConfig['region']) : $cosConfig['region'];
$this->cosConfig['region'] = region_map($cosConfig['region']);
$this->cosConfig['appId'] = isset($cosConfig['credentials']['appId']) ? $cosConfig['credentials']['appId'] : null;
$this->cosConfig['secretId'] = isset($cosConfig['credentials']['secretId']) ? $cosConfig['credentials']['secretId'] : "";
$this->cosConfig['secretKey'] = isset($cosConfig['credentials']['secretKey']) ? $cosConfig['credentials']['secretKey'] : "";
Expand Down
11 changes: 5 additions & 6 deletions src/Qcloud/Cos/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Qcloud\Cos;

$regionmap = array('cn-east'=>'ap-shanghai',
function region_map($region) {
$regionmap = array('cn-east'=>'ap-shanghai',
'cn-south'=>'ap-guangzhou',
'cn-north'=>'ap-beijing-1',
'cn-south-2'=>'ap-guangzhou-2',
Expand All @@ -13,11 +14,9 @@
'sh'=>'ap-shanghai',
'gz'=>'ap-guangzhou',
'cd'=>'ap-chengdu',
'sgp'=>'ap-singapore',);

function region_map($region) {
if (array_key_exists($region, regionmap)) {
return regionmap[$region];
'sgp'=>'ap-singapore');
if (array_key_exists($region, $regionmap)) {
return $regionmap[$region];
}
return $region;
}
Expand Down
Loading