Skip to content

Commit

Permalink
# 5.5.5
Browse files Browse the repository at this point in the history
- bug修复
  • Loading branch information
karisli committed Sep 19, 2018
1 parent 226e5e8 commit d1d5bc0
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 5.5.5
- bug修复

# 5.5.4
- 支持自定义Request的Region的时候支持校验
- ACL设置增加Default有效值
Expand Down
6 changes: 3 additions & 3 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.5.4"
s.version = "5.5.5"
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"

s.homepage = "https://cloud.tencent.com/"
Expand All @@ -9,12 +9,12 @@ s.version = "5.5.4"
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.5.4'
s.dependency "QCloudCore",'5.5.5'
s.static_framework = true

s.subspec 'Transfer' do |sbt|
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/**/*','QCloudCOSXML/Classes/Base/*'
sbt.dependency "QCloudCore",'5.5.4'
sbt.dependency "QCloudCore",'5.5.5'
# sbt.static_framework=true
end
end
2 changes: 1 addition & 1 deletion QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
服务地域名称,可用的服务地域名称请查看官网https://www.qcloud.com/document/product/436/6224中提供的地域,这里填入官网里提供的地域简称,例如ap-beijing-1等。
*/
@property (nonatomic, copy) QCloudRegion regionName;

@property (nonatomic,assign)BOOL isPrefixURL;
/**
服务的基础名称, 默认值为: myqcloud.com
*/
Expand Down
47 changes: 37 additions & 10 deletions QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ - (instancetype) init
if (!self) {
return self;
}
_isPrefixURL = YES;
_serviceName = @"myqcloud.com";
return self;
}
Expand Down Expand Up @@ -53,33 +54,59 @@ -(NSURL *)serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID regionN
return nil;
}

NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID];
NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID]; ;
NSString *regionNametmp = nil;
if (regionName) {
regionNametmp = regionName;
}else{
regionNametmp = self.regionName;
}
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.cos.%@.%@",scheme,formattedBucketName,appID,regionNametmp,self.serviceName]];
NSString *tmpBucket = formattedBucketName;
if (appID) {
tmpBucket = [NSString stringWithFormat:@"%@-%@",formattedBucketName,appID];
}
NSURL *serverURL;

if (_isPrefixURL) {
if (regionNametmp) {
serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.cos.%@.%@",scheme,tmpBucket,regionNametmp,self.serviceName]];
}else{
serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@.cos.%@",scheme,tmpBucket,self.serviceName]];
}
}else{
if (regionNametmp) {
serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://cos.%@.%@/%@",scheme,regionNametmp,self.serviceName,tmpBucket]];
}else{
serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://cos.%@/%@",scheme,self.serviceName,tmpBucket]];
}
}

return serverURL;
}

-(void)setIsPrefixURL:(BOOL)isPrefixURL{
_isPrefixURL = isPrefixURL;
}
- (void)setRegionName:(QCloudRegion)regionName {
//Region 仅允许由 a-z, A-Z, 0-9, 英文句号. 和 - 构成。
NSParameterAssert(regionName);
static NSString *regularExpression = @"[a-zA-Z0-9.-]*";
BOOL isLegal = [regionName matchesRegularExpression:regularExpression];
NSAssert(isLegal, @"Region name contains illegal character! It can only contains a-z, A-Z, 0-9, '.' and '-' ");
if (!isLegal) {
QCloudLogDebug(@"Region %@ contains illeagal character, setter returns immediately", regionName);
return ;
if ([self.serviceName isEqualToString:@"myqcloud.com"]) {
NSParameterAssert(regionName);
static NSString *regularExpression = @"[a-zA-Z0-9.-]*";
BOOL isLegal = [regionName matchesRegularExpression:regularExpression];
NSAssert(isLegal, @"Region name contains illegal character! It can only contains a-z, A-Z, 0-9, '.' and '-' ");
if (!isLegal) {
QCloudLogDebug(@"Region %@ contains illeagal character, setter returns immediately", regionName);
return ;
}
}


_regionName = regionName;
}
- (id)copyWithZone:(NSZone *)zone {
QCloudCOSXMLEndPoint* endpoint = [super copyWithZone:nil];
endpoint.regionName = self.regionName;
endpoint.serviceName = self.serviceName;
endpoint.isPrefixURL = self.isPrefixURL;
return endpoint;
}
@end
5 changes: 5 additions & 0 deletions QCloudCOSXML/Classes/Manager/request/QCloudGetBucketRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,10 @@ - (QCloudSignatureFields*) signatureFields
return fileds;
}


-(QCloudSignature *)signature{
QCloudSignature *sig = [QCloudSignature new];
return sig;
}
@end
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ - (BOOL) customBuildRequestData:(NSError *__autoreleasing *)error
}
self.requestData.serverURL = @"http://service.cos.myqcloud.com";
if (![self.runOnService.configuration.endpoint.serviceName isEqualToString:@"myqcloud.com"]) {
self.requestData.serverURL = [NSString stringWithFormat:@"http://service.cos.%@.%@",self.runOnService.configuration.endpoint.regionName,self.runOnService.configuration.endpoint.serviceName];
if (self.runOnService.configuration.endpoint.regionName) {
self.requestData.serverURL = [NSString stringWithFormat:@"http://service.cos.%@.%@",self.runOnService.configuration.endpoint.regionName,self.runOnService.configuration.endpoint.serviceName];
}else{
self.requestData.serverURL = [NSString stringWithFormat:@"http://service.cos.%@",self.runOnService.configuration.endpoint.serviceName];
}

}

return YES;
Expand Down
6 changes: 3 additions & 3 deletions QCloudCOSXML/Classes/QCloudCOSXMLVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#ifndef QCloudCOSXMLModuleVersion_h
#define QCloudCOSXMLModuleVersion_h
#define QCloudCOSXMLModuleVersionNumber 505004
#define QCloudCOSXMLModuleVersionNumber 505005

//dependency
#if QCloudCoreModuleVersionNumber != 505004
#error "库QCloudCOSXML依赖QCloudCore最小版本号为5.5.4,当前引入的QCloudCore版本号过低,请及时升级后使用"
#if QCloudCoreModuleVersionNumber != 505005
#error "库QCloudCOSXML依赖QCloudCore最小版本号为5.5.5,当前引入的QCloudCore版本号过低,请及时升级后使用"
#endif

//
Expand Down
2 changes: 1 addition & 1 deletion QCloudCOSXML/Classes/QCloudCOSXMLVersion.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "QCloudCOSXMLVersion.h"
NSString * const QCloudCOSXMLModuleVersion = @"5.5.4";
NSString * const QCloudCOSXMLModuleVersion = @"5.5.5";
NSString * const QCloudCOSXMLModuleName = @"QCloudCOSXML";
@interface QCloudQCloudCOSXMLLoad : NSObject
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,6 @@ -(void)setCOSServerSideEncyptionWithKMSCustomKey:(NSString *)customerKey jsonStr
self.customHeaders[@"x-cos-server-side-encryption-context"] = [data base64EncodedStringWithOptions:0];
}
}


@end
2 changes: 1 addition & 1 deletion QCloudCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "QCloudCore"
s.version = "5.5.4"
s.version = "5.5.5"
s.summary = "QCloudCore--腾讯云iOS-SDK Foundation"

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@class QCloudTask;
@class QCloudService;
@class QCloudSignatureFields;
@class QCloudSignature;
NS_ASSUME_NONNULL_BEGIN

/**
Expand All @@ -33,6 +34,7 @@ extern _Nonnull QCloudResponseSerializerBlock QCloudResponseCOSNormalRSPSerilize
*/
@property (nonatomic, weak) QCloudService* _Nullable runOnService;


/*
在进行HTTP请求的时候,可以通过设置该参数来设置自定义的一些头部信息。
通常情况下,携带特定的额外HTTP头部可以使用某项功能,如果是这类需求,可以通过设置该属性来实现。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "QCloudService.h"
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonCrypto.h>

NS_ASSUME_NONNULL_BEGIN

QCloudResponseSerializerBlock QCloudResponseObjectSerilizerBlock(Class modelClass) {
Expand Down
9 changes: 7 additions & 2 deletions QCloudCore/Classes/QCloudClientBase/Request/QCloudService.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ - (instancetype) initWithConfiguration:(QCloudServiceConfiguration *)configurati
if (!configuration.endpoint) {
@throw [NSException exceptionWithName:kQCloudNetworkDomain reason:[NSString stringWithFormat:@"您没有配置EndPoint就使用了服务%@", self.class] userInfo:nil];
}
if (!configuration.appID) {
@throw [NSException exceptionWithName:kQCloudNetworkDomain reason:[NSString stringWithFormat:@"您没有配置AppID就使用了服务%@", self.class] userInfo:nil];
if ([configuration.endpoint.serviceName isEqualToString:@"myqcloud.com"]) {
if (!configuration.appID) {
@throw [NSException exceptionWithName:kQCloudNetworkDomain reason:[NSString stringWithFormat:@"您没有配置AppID就使用了服务%@", self.class] userInfo:nil];
}
}

if (![configuration.signatureProvider conformsToProtocol:NSProtocolFromString(@"QCloudSignatureProvider")]) {
@throw [NSException exceptionWithName:kQCloudNetworkDomain reason:[NSString stringWithFormat:@"您没有配置signatureProvider或者没有实现对应的方法就使用了服务%@", self.class] userInfo:nil];
}


_configuration = configuration;
_signatureCache = [NSMutableDictionary new];
_requestingSignatureFileds = [NSMutableDictionary new];
Expand Down
2 changes: 1 addition & 1 deletion QCloudCore/Classes/QCloudCoreVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#ifndef QCloudCoreModuleVersion_h
#define QCloudCoreModuleVersion_h
#define QCloudCoreModuleVersionNumber 505004
#define QCloudCoreModuleVersionNumber 505005

//dependency

Expand Down
2 changes: 1 addition & 1 deletion QCloudCore/Classes/QCloudCoreVersion.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "QCloudCoreVersion.h"
NSString * const QCloudCoreModuleVersion = @"5.5.4";
NSString * const QCloudCoreModuleVersion = @"5.5.5";
NSString * const QCloudCoreModuleName = @"QCloudCore";
@interface QCloudQCloudCoreLoad : NSObject
@end
Expand Down

0 comments on commit d1d5bc0

Please sign in to comment.