Skip to content

Commit

Permalink
BucketName概念统一。
Browse files Browse the repository at this point in the history
  • Loading branch information
erichmzhang committed Dec 13, 2017
1 parent d11a93a commit abf7745
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 994 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 5.1.3
- BucketName概念统一。

# 5.1.2
- 修复C++混编情况下的问题

Expand Down
4 changes: 2 additions & 2 deletions QCloudCOSXML.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "QCloudCOSXML"
s.version = "5.1.2"
s.version = "5.1.3"
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"

s.homepage = "https://cloud.tencent.com/"
Expand All @@ -9,5 +9,5 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/tencentyun/qcloud-sdk-ios.git", :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'QCloudCOSXML/Classes/**/*'
s.dependency 'QCloudCore','5.1.2'
s.dependency 'QCloudCore','5.1.3'
end
21 changes: 18 additions & 3 deletions QCloudCOSXML/Classes/QCloudCOSXMLEndPoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,30 @@ - (NSString*)formattedRegionName:(NSString*)regionName {
}
}


- (NSString *)formattedBucket:(NSString*)bucket withAPPID:(NSString*)APPID {
NSInteger subfixLength = APPID.length + 1;
if (bucket.length <= subfixLength) {
return bucket;
}
NSString* APPIDSubfix = [NSString stringWithFormat:@"-%@",APPID];
NSString* subfixString = [bucket substringWithRange:NSMakeRange(bucket.length - subfixLength , subfixLength)];
if ([subfixString isEqualToString:APPIDSubfix]) {
return [bucket substringWithRange:NSMakeRange(0, bucket.length - subfixLength)];
}
//should not reach here
return bucket;
}

- (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
{
NSString* scheme = @"https";
if (!self.useHTTPS) {
scheme = @"http";
}
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,bucket,appID,[self formattedRegionName:self.regionName],self.serviceName]];
}
NSString* formattedRegionName = [self formattedRegionName:self.regionName];
NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID];
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,formattedBucketName,appID,formattedRegionName,self.serviceName]];
return serverURL;
}
@end

Loading

0 comments on commit abf7745

Please sign in to comment.