diff --git a/crmeb/crmeb/services/upload/extend/obs/Client.php b/crmeb/crmeb/services/upload/extend/obs/Client.php index 95b905af0..5cdfd7cd0 100644 --- a/crmeb/crmeb/services/upload/extend/obs/Client.php +++ b/crmeb/crmeb/services/upload/extend/obs/Client.php @@ -255,7 +255,7 @@ class Client extends BaseClient ]; $res = $this->request('https://' . $header['Host'] . '/', 'PUT', [ - 'bucket' => $bucket + 'Location' => $region ], $header); return $this->response($res); @@ -335,9 +335,10 @@ class Client extends BaseClient { $header = [ 'Host' => $this->getRequestUrl($bucket, $region), + 'content-md5' => base64_encode(md5(json_encode($data), true)) ]; - $xml = $this->xmlBuild($data, 'CORSConfiguration', ''); - $res = $this->request('https://' . $header['Host'] . '/', 'PUT', [ + $xml = $this->xmlBuild($data, 'CORSConfiguration', 'CORSRule'); + $res = $this->request('https://' . $header['Host'] . '/cors ', 'PUT', [ 'bucket' => $bucket, 'body' => $xml ], $header); diff --git a/crmeb/crmeb/services/upload/storage/Obs.php b/crmeb/crmeb/services/upload/storage/Obs.php index f88eb699b..643f53b67 100644 --- a/crmeb/crmeb/services/upload/storage/Obs.php +++ b/crmeb/crmeb/services/upload/storage/Obs.php @@ -3,6 +3,7 @@ namespace crmeb\services\upload\storage; use crmeb\exceptions\AdminException; +use crmeb\exceptions\UploadException; use crmeb\services\upload\extend\obs\Client as TyClient; use crmeb\services\upload\BaseUpload; @@ -220,12 +221,12 @@ class Obs extends BaseUpload public function setBucketCors(string $name, string $region) { try { - $res = $this->app()->PutBucketCors($name, $region, [ - 'AllowedHeaders' => ['*'], - 'AllowedMethods' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'], - 'AllowedOrigins' => ['*'], - 'ExposeHeaders' => ['ETag', 'Content-Length', 'x-cos-request-id'], - 'MaxAgeSeconds' => 12 + $this->app()->PutBucketCors($name, $region, [ + 'AllowedHeader' => ['*'], + 'AllowedMethod' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'], + 'AllowedOrigin' => ['*'], + 'ExposeHeader' => ['ETag', 'Content-Length', 'x-cos-request-id'], + 'MaxAgeSeconds' => 100 ]); return true; } catch (\Throwable $e) {