Skip to content

Commit abf7745

Browse files
author
erichmzhang
committed
BucketName概念统一。
1 parent d11a93a commit abf7745

File tree

5 files changed

+26
-994
lines changed

5 files changed

+26
-994
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 5.1.3
2+
- BucketName概念统一。
3+
14
# 5.1.2
25
- 修复C++混编情况下的问题
36

QCloudCOSXML.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QCloudCOSXML"
3-
s.version = "5.1.2"
3+
s.version = "5.1.3"
44
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
55

66
s.homepage = "https://cloud.tencent.com/"
@@ -9,5 +9,5 @@ Pod::Spec.new do |s|
99
s.source = { :git => "https://github.com/tencentyun/qcloud-sdk-ios.git", :tag => s.version.to_s }
1010
s.ios.deployment_target = '8.0'
1111
s.source_files = 'QCloudCOSXML/Classes/**/*'
12-
s.dependency 'QCloudCore','5.1.2'
12+
s.dependency 'QCloudCore','5.1.3'
1313
end

QCloudCOSXML/Classes/QCloudCOSXMLEndPoint.m

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,30 @@ - (NSString*)formattedRegionName:(NSString*)regionName {
3636
}
3737
}
3838

39-
39+
- (NSString *)formattedBucket:(NSString*)bucket withAPPID:(NSString*)APPID {
40+
NSInteger subfixLength = APPID.length + 1;
41+
if (bucket.length <= subfixLength) {
42+
return bucket;
43+
}
44+
NSString* APPIDSubfix = [NSString stringWithFormat:@"-%@",APPID];
45+
NSString* subfixString = [bucket substringWithRange:NSMakeRange(bucket.length - subfixLength , subfixLength)];
46+
if ([subfixString isEqualToString:APPIDSubfix]) {
47+
return [bucket substringWithRange:NSMakeRange(0, bucket.length - subfixLength)];
48+
}
49+
//should not reach here
50+
return bucket;
51+
}
4052

4153
- (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
4254
{
4355
NSString* scheme = @"https";
4456
if (!self.useHTTPS) {
4557
scheme = @"http";
46-
}
47-
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,bucket,appID,[self formattedRegionName:self.regionName],self.serviceName]];
58+
}
59+
NSString* formattedRegionName = [self formattedRegionName:self.regionName];
60+
NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID];
61+
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,formattedBucketName,appID,formattedRegionName,self.serviceName]];
4862
return serverURL;
4963
}
5064
@end
65+

0 commit comments

Comments
 (0)