Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tioncico committed Jan 4, 2020
1 parent f16e9c4 commit f16072a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/AliYun/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function getStringToSign($signableQueryString,$options, $headers,$hostType){
foreach ($headers as $headerKey => $headerValue) {
$headerValue = str_replace(array("\r", "\n"), '', $headerValue);
$headerKey = strtolower($headerKey);
if ($headerKey === 'content-md5' || $headerKey === 'content-type' || $headerKey === 'date' || !(isset($options[OssConst::OSS_PREAUTH]) && (integer)$options[OssConst::OSS_PREAUTH] > 0)) {
if ($headerKey === 'content-md5' || $headerKey === 'content-type' || $headerKey === 'date' || (isset($options['OssConst::OSS_PREAUTH']) && (integer)$options['OssConst::OSS_PREAUTH'] > 0)) {
$stringToSign .= $headerValue . "\n";
} elseif (substr($headerKey, 0, 6) === OssConst::OSS_DEFAULT_PREFIX) {
$stringToSign .= $headerKey . ':' . $headerValue . "\n";
Expand Down
19 changes: 10 additions & 9 deletions tests/AliYun/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
$client = new \EasySwoole\Oss\AliYun\OssClient($config);
$data = $client->signUrl(OSS_BUCKET,'oss-test.jpg');
var_dump($data);
// var_dump($client->listBuckets());


$ossClient = new \OSS\OssClient(
ACCESS_KEY_ID,
ACCESS_KEY_SECRET,
END_POINT, false);
$timeout = 3600;
$options = array(
\OSS\OssClient::OSS_PROCESS => "image/resize,m_lfit,h_100,w_100" );
$data = $ossClient->signUrl(OSS_BUCKET,'oss-test.jpg');
var_dump($data);
// $ossClient = new \OSS\OssClient(
// ACCESS_KEY_ID,
// ACCESS_KEY_SECRET,
// END_POINT, false);
// $timeout = 3600;
// $options = array(
// \OSS\OssClient::OSS_PROCESS => "image/resize,m_lfit,h_100,w_100" );
// $data = $ossClient->signUrl(OSS_BUCKET,'oss-test.jpg');
// var_dump($data);

});

0 comments on commit f16072a

Please sign in to comment.