Skip to content

Commit 217b5ae

Browse files
authored
Merge pull request #270 from wangliangliang2/master
fix github issue #269
2 parents c1a6a0f + b26f160 commit 217b5ae

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

QiniuSDK/Storage/QNUpToken.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ - (NSString *)getAccess {
3737
- (NSString *)getBucket:(NSDictionary *)info {
3838

3939
NSString *scope = [info objectForKey:@"scope"];
40-
if (!scope) {
40+
if (!scope || [scope isKindOfClass:[NSNull class]] ) {
4141
return @"";
4242
}
4343

QiniuSDKTests/QNUpTokenTest.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,11 @@ - (void)testReturnUrl {
5656
XCTAssert(t.hasReturnUrl, @"Pass");
5757
}
5858

59+
- (void)testScopeNull {
60+
QNUpToken *t = [QNUpToken parse:@"k4MXrVJes7RoS7N7teQDfkVqDDXqNOZq5BOfjzPn:MDllYmMxYTkyNjIxZTg0N2NjYTUwNDg0MGIyOWQxYjhjMTBlZTc0Ngo=:eyJzY29wZSI6bnVsbCwiZGVhZGxpbmUiOjE1MTM3Njg3ODl9Cg=="];
61+
// This is an example of a functional test case.
62+
XCTAssert([t.bucket isEqualToString:@""], @"Pass");
63+
}
64+
65+
5966
@end

0 commit comments

Comments
 (0)