Skip to content

Commit caa77bb

Browse files
author
erichmzhang
committed
#5.4.6
- Get Object Request 增加 versionID 支持 \-static_frameworks支持
1 parent 0d1eabf commit caa77bb

19 files changed

+108
-30
lines changed

CHANGELOG.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1+
#5.4.6
2+
- Get Object Request 增加 versionID 支持
3+
-static_frameworks支持
4+
15
#5.4.5
26
- 修复一些 Crash
3-
7+
48
# 5.4.4
59
- QCloudCOSXMLService 中封装了一些常用接口
610
- 修复了对于中文路径,并且路径中带/结尾时签名不正确的问题
711
- 修复了多版本相关接口里的问题
812
- 修复了分片上传 Resume 时,如果路径不在沙盒中会失败的问题
913
- 修复了与 FCUUID 冲突的问题
10-
14+
1115
#5.4.3
1216
- 修复Copy接口中,source为中文时会导致403的问题
13-
17+
1418
# 5.4.2
1519
- 修复了返回数组类型的属性,如果数组内容只有一个时候会解析失败的问题。
16-
20+
1721
# 5.4.1
1822
- 修复了 XML 中以 / 结尾的 Object 会403的的问题。
19-
23+
2024
# 5.4.0
21-
- 修复了iOS8上面首次上传失败的问题
25+
- 修复了iOS8上面首次上传失败的问题
2226
- 修复了反复多次调用分块复制接口会Crash的问题
23-
27+
2428
# 5.3.4
2529
- 修复了 GetBucket 时,无法正确获得 Common Prefix 的 BUG。
26-
30+
2731
# 5.3.2
2832
- 修复了签名时取到的某些头部可能会变更的问题
29-
33+
3034
# 5.3.0
3135
- 增加了生成预签名 URL 的接口。
3236
- 增加列出指定前缀 Object 所有版本的接口。
@@ -37,25 +41,24 @@
3741
- 针对弱网络情况进行优化,大幅度提高弱网络情况下上传成功率。
3842
- 修复分块 Copy 大文件的问题。
3943
- 签名计算时支持自定义开始和结束时间。
40-
44+
4145
# 5.2.0
4246
- 增加了精简版的SDK,只支持上传下载功能。
4347
- BucketName概念统一。
4448
- 支持查看Response中原始的HTTP Response内容。
4549
- 其它一些BUG修复与性能优化。
46-
50+
4751
# 5.1.3
4852
- BucketName概念统一。
49-
53+
5054
# 5.1.2
5155
- 修复C++混编情况下的问题
52-
56+
5357
# 5.1.1
5458
- 修复了一些问题
55-
59+
5660
# 5.1.0
5761
- 增加了LifeCycle相关接口。
5862
- 增加了Copy Object的接口。
5963
- 分块上传初始化时,返回resumeData,方便异常情况中断后的续传。
6064
- 其它一些优化。
61-

QCloudCOSXML.podspec

Lines changed: 3 additions & 3 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.4.5"
3+
s.version = "5.4.6"
44
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
55

66
s.homepage = "https://cloud.tencent.com/"
@@ -9,12 +9,12 @@ s.version = "5.4.5"
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.4.5'
12+
s.dependency "QCloudCore",'5.4.6'
1313
s.static_framework = true
1414

1515
s.subspec 'Transfer' do |sbt|
1616
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/*','QCloudCOSXML/Classes/Base/*'
17-
sbt.dependency "QCloudCore",'5.4.5'
17+
sbt.dependency "QCloudCore",'5.4.6'
1818
# sbt.static_framework=true
1919
end
2020
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// NSString+RegularExpressionCategory.h
3+
// QCloudCOSXML
4+
//
5+
// Created by erichmzhang(张恒铭) on 29/06/2018.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
@interface NSString (RegularExpressionCategory)
11+
- (BOOL) matchesRegularExpression:(NSString *)regularExpression;
12+
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// NSString+RegularExpressionCategory.m
3+
// QCloudCOSXML
4+
//
5+
// Created by erichmzhang(张恒铭) on 29/06/2018.
6+
//
7+
8+
#import "NSString+RegularExpressionCategory.h"
9+
10+
@implementation NSString (RegularExpressionCategory)
11+
- (BOOL) matchesRegularExpression:(NSString *)regularExpression {
12+
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regularExpression];
13+
return [predicate evaluateWithObject:self];
14+
}
15+
@end

QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.m

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import "QCloudCOSXMLEndPoint.h"
10-
10+
#import "NSString+RegularExpressionCategory.h"
1111
@implementation QCloudCOSXMLEndPoint
1212

1313
- (instancetype) init
@@ -56,12 +56,33 @@ - (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
5656
if (!self.useHTTPS) {
5757
scheme = @"http";
5858
}
59+
static NSString *regularExpression = @"[a-zA-Z0-9.-]*";
60+
BOOL isLegal = [bucket matchesRegularExpression:regularExpression];
61+
NSAssert(isLegal, @"bucket name contains illegal character! It can only contains a-z, A-Z, 0-9, '.' and '-' ");
62+
if (!isLegal) {
63+
QCloudLogDebug(@"bucket %@ contains illeagal character, building service url pregress returns immediately", bucket);
64+
return nil;
65+
}
66+
5967
NSString* formattedRegionName = [self formattedRegionName:self.regionName];
6068
NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID];
6169
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,formattedBucketName,appID,formattedRegionName,self.serviceName]];
6270
return serverURL;
6371
}
6472

73+
- (void)setRegionName:(QCloudRegion)regionName {
74+
//Region 仅允许由 a-z, A-Z, 0-9, 英文句号. 和 - 构成。
75+
NSParameterAssert(regionName);
76+
static NSString *regularExpression = @"[a-zA-Z0-9.-]*";
77+
BOOL isLegal = [regionName matchesRegularExpression:regularExpression];
78+
NSAssert(isLegal, @"Region name contains illegal character! It can only contains a-z, A-Z, 0-9, '.' and '-' ");
79+
if (!isLegal) {
80+
QCloudLogDebug(@"Region %@ contains illeagal character, setter returns immediately", regionName);
81+
return ;
82+
}
83+
_regionName = regionName;
84+
}
85+
6586
- (id)copyWithZone:(NSZone *)zone {
6687
QCloudCOSXMLEndPoint* endpoint = [super copyWithZone:nil];
6788
endpoint.regionName = self.regionName;

QCloudCOSXML/Classes/Manager/QCloudGetObjectACLRequest.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ request.object = @"objectName";
6464
对象名
6565
*/
6666
@property (strong, nonatomic) NSString *object;
67+
/**
68+
指定多版本中的 Version ID
69+
*/
70+
@property (strong, nonatomic) NSString *versionID;
6771

6872

6973
- (void) setFinishBlock:(void (^)(QCloudACLPolicy* result, NSError * error))QCloudRequestFinishBlock;

QCloudCOSXML/Classes/Manager/QCloudGetObjectACLRequest.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ - (BOOL) buildRequestData:(NSError *__autoreleasing *)error
9393
return NO;
9494
}
9595
}
96+
if (self.versionID) {
97+
[self.requestData setValue:self.versionID forHTTPHeaderField:@"x-cos-version-id"];
98+
}
9699
self.requestData.URIMethod = @"acl";
97100
NSMutableArray* __pathComponents = [NSMutableArray arrayWithArray:self.requestData.URIComponents];
98101
if(self.object) [__pathComponents addObject:self.object];

QCloudCOSXML/Classes/QCloudCOSXMLVersion.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
#ifndef QCloudCOSXMLModuleVersion_h
88
#define QCloudCOSXMLModuleVersion_h
9-
#define QCloudCOSXMLModuleVersionNumber 504005
9+
#define QCloudCOSXMLModuleVersionNumber 504006
1010

1111
//dependency
12-
#if QCloudCoreModuleVersionNumber != 504005
13-
#error "库QCloudCOSXML依赖QCloudCore最小版本号为5.4.5,当前引入的QCloudCore版本号过低,请及时升级后使用"
12+
#if QCloudCoreModuleVersionNumber != 504006
13+
#error "库QCloudCOSXML依赖QCloudCore最小版本号为5.4.6,当前引入的QCloudCore版本号过低,请及时升级后使用"
1414
#endif
1515

1616
//
1717
FOUNDATION_EXTERN NSString * const QCloudCOSXMLModuleVersion;
1818
FOUNDATION_EXTERN NSString * const QCloudCOSXMLModuleName;
1919

20-
#endif
20+
#endif

QCloudCOSXML/Classes/QCloudCOSXMLVersion.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import "QCloudCOSXMLVersion.h"
2-
NSString * const QCloudCOSXMLModuleVersion = @"5.4.5";
2+
NSString * const QCloudCOSXMLModuleVersion = @"5.4.6";
33
NSString * const QCloudCOSXMLModuleName = @"QCloudCOSXML";
44
@interface QCloudQCloudCOSXMLLoad : NSObject
55
@end
@@ -26,4 +26,4 @@ + (void) load
2626
#pragma clang diagnostic pop
2727
}
2828
}
29-
@end
29+
@end

QCloudCOSXML/Classes/Transfer/QCloudGetObjectRequest.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ RFC 2616 中定义的指定文件下载范围,以字节(bytes)为单位
102102
*/
103103
@property (strong, nonatomic) NSString *ifNoneMatch;
104104
/**
105+
指定 Object 的 VersionID (在开启多版本的情况下)
106+
*/
107+
@property (strong, nonatomic) NSString *versionID;
108+
/**
105109
对象名
106110
*/
107111
@property (strong, nonatomic) NSString *object;

0 commit comments

Comments
 (0)