Skip to content

Commit

Permalink
update description
Browse files Browse the repository at this point in the history
  • Loading branch information
tuunalai committed May 17, 2024
1 parent 0aa8f7e commit eb80d3d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,17 @@ class Client extends GuzzleClient {
'locationWithScheme' => false,
'autoChange' => true,
'limit_flag' => false,
'isCheckRequestPath' => true,
];

public function __construct(array $cosConfig) {
$this->rawCosConfig = $cosConfig;

$this->cosConfig = processCosConfig(array_replace_recursive($this->cosConfig, $cosConfig));

global $globalCosConfig;
$globalCosConfig = $this->cosConfig;

// check config
$this->inputCheck();

Expand Down Expand Up @@ -409,6 +413,7 @@ public function __construct(array $cosConfig) {
null);
}


public function inputCheck() {
$message = null;
//检查Region
Expand Down Expand Up @@ -458,7 +463,7 @@ public function commandToRequestTransformer(CommandInterface $command)
public function responseToResultTransformer(ResponseInterface $response, RequestInterface $request, CommandInterface $command)
{

$transformer = new ResultTransformer($this->cosConfig, $this->operation);
$transformer = new ResultTransformer($this->cosConfig, $this->operation);
$transformer->writeDataToLocal($command, $request, $response);
$deseri = new Deserializer($this->desc, true);
$result = $deseri($response, $request, $command);
Expand All @@ -469,7 +474,7 @@ public function responseToResultTransformer(ResponseInterface $response, Request
$result = $transformer->ciContentInfoTransformer($command, $result);
return $result;
}

public function __destruct() {
}

Expand Down Expand Up @@ -571,8 +576,8 @@ public static function simplifyPath($path) {
public function download($bucket, $key, $saveAs, $options = array()) {
$options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : RangeDownload::DEFAULT_PART_SIZE;
$versionId = isset($options['VersionId']) ? $options['VersionId'] : '';
if ("/" == self::simplifyPath($key)) {
$e = new Exception\CosException('GET OBEJCT NOT FOUND');
if ($this->cosConfig['isCheckRequestPath'] && "/" == self::simplifyPath($key)) {
$e = new Exception\CosException('Getobject Key is illegal');
$e->setExceptionCode('404');
throw $e;
}
Expand Down Expand Up @@ -683,9 +688,9 @@ public function doesObjectExist($bucket, $key, array $options = array())
}

public static function explodeKey($key) {

if ("/" == self::simplifyPath($key)) {
$e = new Exception\CosException('GET OBEJCT NOT FOUND');
global $globalCosConfig;
if ($globalCosConfig['isCheckRequestPath'] && "/" == self::simplifyPath($key)) {
$e = new Exception\CosException('Getobject Key is illegal');
$e->setExceptionCode('404');
throw $e;
}
Expand Down

0 comments on commit eb80d3d

Please # to comment.