|
|
@@ -440,11 +440,14 @@ class Cos extends BaseUpload
|
|
|
public function deleteBucket(string $name)
|
|
|
{
|
|
|
try {
|
|
|
- $this->app()->deleteBucket($name);
|
|
|
- return true;
|
|
|
+ $res = $this->app()->deleteBucket($name);
|
|
|
+ if ($res->get('RequestId')) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
} catch (\Throwable $e) {
|
|
|
return $this->setError($e->getMessage());
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -456,8 +459,8 @@ class Cos extends BaseUpload
|
|
|
{
|
|
|
$this->storageRegion = $region;
|
|
|
try {
|
|
|
- $res = $this->app()->getBucketDomain($name);
|
|
|
- $domainRules = $res['DomainRules'];
|
|
|
+ $res = $this->app()->GetBucketDomain($name);
|
|
|
+ $domainRules = $res->toArray()['DomainRules'];
|
|
|
return array_column($domainRules, 'Name');
|
|
|
} catch (\Throwable $e) {
|
|
|
}
|
|
|
@@ -530,11 +533,11 @@ class Cos extends BaseUpload
|
|
|
{
|
|
|
$this->storageRegion = $region;
|
|
|
try {
|
|
|
- $res = $this->app()->putBucketCors($name, [
|
|
|
- 'AllowedHeader' => ['*'],
|
|
|
- 'AllowedMethod' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'],
|
|
|
- 'AllowedOrigin' => ['*'],
|
|
|
- 'ExposeHeader' => ['ETag', 'Content-Length', 'x-cos-request-id'],
|
|
|
+ $res = $this->app()->PutBucketCors($name, [
|
|
|
+ 'AllowedHeaders' => ['*'],
|
|
|
+ 'AllowedMethods' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'],
|
|
|
+ 'AllowedOrigins' => ['*'],
|
|
|
+ 'ExposeHeaders' => ['ETag', 'Content-Length', 'x-cos-request-id'],
|
|
|
'MaxAgeSeconds' => 12
|
|
|
]);
|
|
|
if (isset($res['RequestId'])) {
|