Skip to content

Commit 36a7d8e

Browse files
committed
fixed copypolicy
1 parent d20a2f4 commit 36a7d8e

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ php:
1010
before_script:
1111
- export QINIU_ACCESS_KEY="QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm"
1212
- export QINIU_SECRET_KEY="Bxckh6FA-Fbs9Yt3i3cbKVK22UPBmAOHJcL95pGz"
13-
- export QINIU_BUCKET_NAME="phpsdk"
14-
- export QINIU_KEY_NAME="php-logo.png"
13+
- export QINIU_TEST_BUCKET="phpsdk"
14+
- export QINIU_TEST_KEY="php-logo.png"
1515
- export QINIU_TEST_ENV="travis"
1616
- composer install --prefer-source
1717
script:

src/Qiniu/Auth.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ public function uploadToken(
7979
if ($key != null) {
8080
$scope .= ':' . $key;
8181
}
82-
$args = array('scope' => $scope, 'deadline' => $deadline);
83-
self::copyPolicy($args, $policy, $strictPolicy);
82+
$args = array();
83+
$args = self::copyPolicy($args, $policy, $strictPolicy);
84+
$args['scope'] = $scope;
85+
$args['deadline'] = $deadline;
8486
$b = json_encode($args);
8587
return $this->tokenWithData($b);
8688
}
@@ -125,6 +127,7 @@ private static function copyPolicy($policy, $originPolicy, $strictPolicy)
125127
$policy[$key] = $value;
126128
}
127129
}
130+
return $policy;
128131
}
129132

130133
public function authorization($url, $body = null, $contentType = null)

src/Qiniu/Storage/ResumeUploader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private function post($url, $data)
117117
private function blockSize($uploaded)
118118
{
119119
if ($this->size < $uploaded + Config::BLOCK_SIZE) {
120-
return $bsize = $this->size - $uploaded;
120+
return $this->size - $uploaded;
121121
}
122122
return Config::BLOCK_SIZE;
123123
}

tests/Qiniu/Tests/AuthTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testUploadToken()
7171
global $dummyAuth;
7272
$_SERVER['override_qiniu_auth_time'] = true;
7373
$token = $dummyAuth->uploadToken('1', '2', 3600, array('endUser'=> 'y'));
74-
$exp = 'abcdefghklmnopq:x53hx7845_pygLochtRWlnrL-90=:eyJzY29wZSI6IjE6MiIsImRlYWRsaW5lIjoxMjM0NTcxNDkwfQ==';
74+
$exp = 'abcdefghklmnopq:yyeexeUkPOROoTGvwBjJ0F0VLEo=:eyJlbmRVc2VyIjoieSIsInNjb3BlIjoiMToyIiwiZGVhZGxpbmUiOjEyMzQ1NzE0OTB9';
7575
$this->assertEquals($exp, $token);
7676
unset($_SERVER['override_qiniu_auth_time']);
7777
}

tests/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
$accessKey = getenv('QINIU_ACCESS_KEY');
88
$secretKey = getenv('QINIU_SECRET_KEY');
99
$testAuth = new Auth($accessKey, $secretKey);
10-
$bucketName = getenv('QINIU_BUCKET_NAME');
11-
$key = getenv('QINIU_KEY_NAME');
10+
$bucketName = getenv('QINIU_TEST_BUCKET');
11+
$key = getenv('QINIU_TEST_KEY');
1212

1313
$dummyAccessKey = 'abcdefghklmnopq';
1414
$dummySecretKey = '1234567890';

0 commit comments

Comments
 (0)