@@ -297,13 +297,17 @@ class Client extends GuzzleClient {
297297 'locationWithScheme ' => false ,
298298 'autoChange ' => true ,
299299 'limit_flag ' => false ,
300+ 'isCheckRequestPath ' => true ,
300301 ];
301302
302303 public function __construct (array $ cosConfig ) {
303304 $ this ->rawCosConfig = $ cosConfig ;
304305
305306 $ this ->cosConfig = processCosConfig (array_replace_recursive ($ this ->cosConfig , $ cosConfig ));
306307
308+ global $ globalCosConfig ;
309+ $ globalCosConfig = $ this ->cosConfig ;
310+
307311 // check config
308312 $ this ->inputCheck ();
309313
@@ -409,6 +413,7 @@ public function __construct(array $cosConfig) {
409413 null );
410414 }
411415
416+
412417 public function inputCheck () {
413418 $ message = null ;
414419 //检查Region
@@ -458,7 +463,7 @@ public function commandToRequestTransformer(CommandInterface $command)
458463 public function responseToResultTransformer (ResponseInterface $ response , RequestInterface $ request , CommandInterface $ command )
459464 {
460465
461- $ transformer = new ResultTransformer ($ this ->cosConfig , $ this ->operation );
466+ $ transformer = new ResultTransformer ($ this ->cosConfig , $ this ->operation );
462467 $ transformer ->writeDataToLocal ($ command , $ request , $ response );
463468 $ deseri = new Deserializer ($ this ->desc , true );
464469 $ result = $ deseri ($ response , $ request , $ command );
@@ -469,7 +474,7 @@ public function responseToResultTransformer(ResponseInterface $response, Request
469474 $ result = $ transformer ->ciContentInfoTransformer ($ command , $ result );
470475 return $ result ;
471476 }
472-
477+
473478 public function __destruct () {
474479 }
475480
@@ -571,8 +576,8 @@ public static function simplifyPath($path) {
571576 public function download ($ bucket , $ key , $ saveAs , $ options = array ()) {
572577 $ options ['PartSize ' ] = isset ($ options ['PartSize ' ]) ? $ options ['PartSize ' ] : RangeDownload::DEFAULT_PART_SIZE ;
573578 $ versionId = isset ($ options ['VersionId ' ]) ? $ options ['VersionId ' ] : '' ;
574- if ("/ " == self ::simplifyPath ($ key )) {
575- $ e = new Exception \CosException ('GET OBEJCT NOT FOUND ' );
579+ if ($ this -> cosConfig [ ' isCheckRequestPath ' ] && "/ " == self ::simplifyPath ($ key )) {
580+ $ e = new Exception \CosException ('Getobject Key is illegal ' );
576581 $ e ->setExceptionCode ('404 ' );
577582 throw $ e ;
578583 }
@@ -683,9 +688,9 @@ public function doesObjectExist($bucket, $key, array $options = array())
683688 }
684689
685690 public static function explodeKey ($ key ) {
686-
687- if ("/ " == self ::simplifyPath ($ key )) {
688- $ e = new Exception \CosException ('GET OBEJCT NOT FOUND ' );
691+ global $ globalCosConfig ;
692+ if ($ globalCosConfig [ ' isCheckRequestPath ' ] && "/ " == self ::simplifyPath ($ key )) {
693+ $ e = new Exception \CosException ('Getobject Key is illegal ' );
689694 $ e ->setExceptionCode ('404 ' );
690695 throw $ e ;
691696 }
0 commit comments