From d35463c3583eeba64558e33a14654a108f5d3ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Fri, 20 Dec 2019 10:36:08 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=94=B9bucketName,endpoint?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AliyunOSSSDK/OSSNetworkingRequestDelegate.m | 38 ++++++++++++--------- AliyunOSSSDK/OSSUtil.m | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/AliyunOSSSDK/OSSNetworkingRequestDelegate.m b/AliyunOSSSDK/OSSNetworkingRequestDelegate.m index 8d36a9b6..5017d882 100644 --- a/AliyunOSSSDK/OSSNetworkingRequestDelegate.m +++ b/AliyunOSSSDK/OSSNetworkingRequestDelegate.m @@ -78,23 +78,29 @@ - (OSSTask *)buildInternalHttpRequest { NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithString:urlString]; NSString *headerHost = nil; - if ([self.allNeededMessage.bucketName oss_isNotEmpty]) { - OSSIPv6Adapter *ipAdapter = [OSSIPv6Adapter getInstance]; - if ([OSSUtil isOssOriginBucketHost:urlComponents.host]) { - // eg. insert bucket to the begining of host. - urlComponents.host = [NSString stringWithFormat:@"%@.%@", self.allNeededMessage.bucketName, urlComponents.host]; - headerHost = urlComponents.host; - - if ([urlComponents.scheme.lowercaseString isEqualToString:@"http"] && self.isHttpdnsEnable) { - NSString *dnsResult = [OSSUtil getIpByHost: urlComponents.host]; - urlComponents.host = dnsResult; - } - } else if ([ipAdapter isIPv4Address:urlComponents.host] || [ipAdapter isIPv6Address:urlComponents.host]) { - urlComponents.path = [NSString stringWithFormat:@"/%@%@",self.allNeededMessage.bucketName, urlComponents.path]; - } - } + NSURLComponents *temComs = [NSURLComponents new]; + temComs.scheme = urlComponents.scheme; + temComs.host = urlComponents.host; + temComs.port = urlComponents.port; - urlString = urlComponents.string; + + + if ([self.allNeededMessage.bucketName oss_isNotEmpty]) { + OSSIPv6Adapter *ipAdapter = [OSSIPv6Adapter getInstance]; + if ([OSSUtil isOssOriginBucketHost:temComs.host]) { + // eg. insert bucket to the begining of host. + temComs.host = [NSString stringWithFormat:@"%@.%@", self.allNeededMessage.bucketName, temComs.host]; + headerHost = temComs.host; + if ([temComs.scheme.lowercaseString isEqualToString:@"http"] && self.isHttpdnsEnable) { + NSString *dnsResult = [OSSUtil getIpByHost: temComs.host]; + temComs.host = dnsResult; + } + } else if ([ipAdapter isIPv4Address:urlComponents.host] || [ipAdapter isIPv6Address:urlComponents.host]) { + temComs.path = [NSString stringWithFormat:@"/%@",self.allNeededMessage.bucketName]; + } + } + + urlString = temComs.string; // join object name if ([self.allNeededMessage.objectKey oss_isNotEmpty]) { diff --git a/AliyunOSSSDK/OSSUtil.m b/AliyunOSSSDK/OSSUtil.m index b62144ee..277bcf9a 100644 --- a/AliyunOSSSDK/OSSUtil.m +++ b/AliyunOSSSDK/OSSUtil.m @@ -139,7 +139,7 @@ + (BOOL)validateBucketName:(NSString *)bucketName { static NSRegularExpression *regEx; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - regEx = [[NSRegularExpression alloc] initWithPattern:@"^[a-z0-9][a-z0-9_\\-]{2,62}$" options:NSRegularExpressionCaseInsensitive error:nil]; + regEx = [[NSRegularExpression alloc] initWithPattern:@"^[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]$" options:NSRegularExpressionCaseInsensitive error:nil]; }); NSUInteger regExMatches = [regEx numberOfMatchesInString:bucketName options:0 range:NSMakeRange(0, [bucketName length])]; return regExMatches != 0; From 473232619b174694b07af1f987615d2d76dd208d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Fri, 20 Dec 2019 10:38:06 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AliyunOSSSDK/OSSNetworkingRequestDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AliyunOSSSDK/OSSNetworkingRequestDelegate.m b/AliyunOSSSDK/OSSNetworkingRequestDelegate.m index 5017d882..7bfced4a 100644 --- a/AliyunOSSSDK/OSSNetworkingRequestDelegate.m +++ b/AliyunOSSSDK/OSSNetworkingRequestDelegate.m @@ -95,7 +95,7 @@ - (OSSTask *)buildInternalHttpRequest { NSString *dnsResult = [OSSUtil getIpByHost: temComs.host]; temComs.host = dnsResult; } - } else if ([ipAdapter isIPv4Address:urlComponents.host] || [ipAdapter isIPv6Address:urlComponents.host]) { + } else if ([ipAdapter isIPv4Address:temComs.host] || [ipAdapter isIPv6Address:temComs.host]) { temComs.path = [NSString stringWithFormat:@"/%@",self.allNeededMessage.bucketName]; } } From fc3f90c3f26179dc4efea7b288fb676d89ec05a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Fri, 20 Dec 2019 14:18:36 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AliyunOSSSDK/OSSNetworkingRequestDelegate.m | 2 - AliyunOSSiOSTests/OSSUtilsTests.m | 59 +++++++++++++++ .../OSSSwiftDemo.xcodeproj/project.pbxproj | 4 + .../OSSSwiftDemoTests/OSSUtilsTests.swift | 74 +++++++++++++++++++ Supporting Files/AliyunOSSiOS.h | 1 + 5 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift diff --git a/AliyunOSSSDK/OSSNetworkingRequestDelegate.m b/AliyunOSSSDK/OSSNetworkingRequestDelegate.m index 7bfced4a..4bc33079 100644 --- a/AliyunOSSSDK/OSSNetworkingRequestDelegate.m +++ b/AliyunOSSSDK/OSSNetworkingRequestDelegate.m @@ -83,8 +83,6 @@ - (OSSTask *)buildInternalHttpRequest { temComs.host = urlComponents.host; temComs.port = urlComponents.port; - - if ([self.allNeededMessage.bucketName oss_isNotEmpty]) { OSSIPv6Adapter *ipAdapter = [OSSIPv6Adapter getInstance]; if ([OSSUtil isOssOriginBucketHost:temComs.host]) { diff --git a/AliyunOSSiOSTests/OSSUtilsTests.m b/AliyunOSSiOSTests/OSSUtilsTests.m index 9e4f5aee..05ba232e 100644 --- a/AliyunOSSiOSTests/OSSUtilsTests.m +++ b/AliyunOSSiOSTests/OSSUtilsTests.m @@ -71,4 +71,63 @@ - (void)testPerformanceExample { }]; } +- (void)testBucketName{ + + ///^[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]$" + BOOL result1 = [OSSUtil validateBucketName:@"123-456abc"]; + XCTAssertTrue(result1); + BOOL result2 = [OSSUtil validateBucketName:@"123-456abc-"]; + XCTAssertFalse(result2); + BOOL result3 = [OSSUtil validateBucketName:@"-123-456abc"]; + XCTAssertFalse(result3); + BOOL result4 = [OSSUtil validateBucketName:@"123\\456abc"]; + XCTAssertFalse(result4); + +} + + +- (void)testEndpoint{ + NSString *bucketName = @"test-image"; + NSString *result1 = [self getResultEndpoint:@"http://123.test:8989/path?ooob" andBucketName:bucketName]; + XCTAssertTrue([result1 isEqualToString:@"http://123.test:8989"]); + + + NSString *result2 = [self getResultEndpoint:@"http://192.168.0.1:8081" andBucketName:bucketName]; + XCTAssertTrue([result2 isEqualToString:@"http://192.168.0.1:8081/test-image"]); + + NSString *result3 = [self getResultEndpoint:@"http://192.168.0.1" andBucketName:bucketName]; + XCTAssertTrue([result3 isEqualToString:@"http://192.168.0.1/test-image"]); + + NSString *result4 = [self getResultEndpoint:@"http://oss-cn-region.aliyuncs.com" andBucketName:bucketName]; + XCTAssertTrue([result4 isEqualToString:@"http://test-image.oss-cn-region.aliyuncs.com"]); + +} + +- (NSString *)getResultEndpoint:(NSString *)endpoint andBucketName:(NSString *)name{ + NSURLComponents *urlComponents = [[NSURLComponents alloc]initWithString:endpoint]; + + NSURLComponents *temComs = [NSURLComponents new]; + temComs.scheme = urlComponents.scheme; + temComs.host = urlComponents.host; + temComs.port = urlComponents.port; + + if ([name oss_isNotEmpty]) { + OSSIPv6Adapter *ipAdapter = [OSSIPv6Adapter getInstance]; + if ([OSSUtil isOssOriginBucketHost:temComs.host]) { + // eg. insert bucket to the begining of host. + temComs.host = [NSString stringWithFormat:@"%@.%@", + name, temComs.host]; + if ([temComs.scheme.lowercaseString isEqualToString:@"http"] ) { + NSString *dnsResult = [OSSUtil getIpByHost: temComs.host]; + temComs.host = dnsResult; + } + } else if ([ipAdapter isIPv4Address:temComs.host] || [ipAdapter isIPv6Address:temComs.host]) { + temComs.path = [NSString stringWithFormat:@"/%@",name]; + } + } + return temComs.string; +} + + + @end diff --git a/OSSSwiftDemo/OSSSwiftDemo.xcodeproj/project.pbxproj b/OSSSwiftDemo/OSSSwiftDemo.xcodeproj/project.pbxproj index 93ad3264..e00fc620 100644 --- a/OSSSwiftDemo/OSSSwiftDemo.xcodeproj/project.pbxproj +++ b/OSSSwiftDemo/OSSSwiftDemo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0F1C7D7023AC9425000B4E56 /* OSSUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F1C7D6F23AC9425000B4E56 /* OSSUtilsTests.swift */; }; D8350C7B1FFF66B400D8DF46 /* test.xml in Resources */ = {isa = PBXBuildFile; fileRef = D8350C6D1FFF66B400D8DF46 /* test.xml */; }; D8350C7C1FFF66B400D8DF46 /* wangwang.zip in Resources */ = {isa = PBXBuildFile; fileRef = D8350C6E1FFF66B400D8DF46 /* wangwang.zip */; }; D8350C801FFF66B400D8DF46 /* OSSSwiftGlobalDefines.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8350C761FFF66B400D8DF46 /* OSSSwiftGlobalDefines.swift */; }; @@ -67,6 +68,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0F1C7D6F23AC9425000B4E56 /* OSSUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSSUtilsTests.swift; sourceTree = ""; }; D8350C6D1FFF66B400D8DF46 /* test.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = test.xml; sourceTree = ""; }; D8350C6E1FFF66B400D8DF46 /* wangwang.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = wangwang.zip; sourceTree = ""; }; D8350C701FFF66B400D8DF46 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -222,6 +224,7 @@ D8F27EAF200C4CD9005A2C39 /* OSSCnameTests.swift */, D852773F2010B21A00D7B1DE /* SequentialMultipartUploadTests.swift */, D83CEFF5201F1BFD00F917E1 /* TriggerCallBackTests.swift */, + 0F1C7D6F23AC9425000B4E56 /* OSSUtilsTests.swift */, ); path = OSSSwiftDemoTests; sourceTree = ""; @@ -349,6 +352,7 @@ D8E64170200A31530023DF48 /* OSSProviderTests.swift in Sources */, D8E641642009C0EB0023DF48 /* OSSExceptionalTests.swift in Sources */, D8D4DE112008BCE9000B9EBB /* OSSCheckCRC64Tests.swift in Sources */, + 0F1C7D7023AC9425000B4E56 /* OSSUtilsTests.swift in Sources */, D83CEFF6201F1BFD00F917E1 /* TriggerCallBackTests.swift in Sources */, D85277402010B21A00D7B1DE /* SequentialMultipartUploadTests.swift in Sources */, D8E6416C2009D93F0023DF48 /* OSSLogTests.swift in Sources */, diff --git a/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift b/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift new file mode 100644 index 00000000..c13e49f4 --- /dev/null +++ b/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift @@ -0,0 +1,74 @@ +// +// OSSUtilsTests.swift +// OSSSwiftDemoTests +// +// Created by 剑子 on 2019/12/20. +// Copyright © 2019 aliyun. All rights reserved. +// + +import XCTest + +import AliyunOSSiOS +import AliyunOSSSwiftSDK + + +class OSSUtilsTests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + + func testBucketName(){ + ///^[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]$" + let result1 = OSSUtil.validateBucketName("123-456abc") + XCTAssertTrue(result1) + let result2 = OSSUtil.validateBucketName("123-456abc-") + XCTAssertFalse(result2) + let result3 = OSSUtil.validateBucketName("-123-456abc") + XCTAssertFalse(result3) + let str4 = String("123\\456abc") + let result4 = OSSUtil.validateBucketName(str4) + XCTAssertFalse(result4) + } + + func testEndpoint(){ + let bucketName = "test-image" + let result1 = getResultEndpoint(endpoint: "http://123.test:8989/path?ooob") + XCTAssertTrue((result1 == "http://123.test:8989")) + let result2 = getResultEndpoint(endpoint: "http://192.168.0.1:8081") + XCTAssertTrue((result2 == "http://192.168.0.1:8081/\(bucketName)")) + let result3 = getResultEndpoint(endpoint: "http://192.168.0.1") + XCTAssertTrue((result3 == "http://192.168.0.1/\(bucketName)")) + let result4 = getResultEndpoint(endpoint: "http://oss-cn-region.aliyuncs.com") + XCTAssertTrue((result4 == "http://\(bucketName).oss-cn-region.aliyuncs.com")) + } + + func getResultEndpoint(endpoint : String) -> String { + let bucketName = "test-image" + let urlComs = URLComponents.init(string: endpoint) + var temComs = URLComponents.init() + temComs.scheme = urlComs?.scheme + temComs.host = urlComs?.host + temComs.port = urlComs?.port + + if (bucketName as NSString).oss_isNotEmpty() { + let ipAdapter = OSSIPv6Adapter.getInstance() + if OSSUtil.isOssOriginBucketHost(temComs.host!) { + temComs.host = bucketName + "." + temComs.host! + if (temComs.scheme?.lowercased() == "http") { + let dnsResult = OSSUtil.getIpByHost(temComs.host!) + temComs.host = dnsResult + } + }else if(ipAdapter!.isIPv4Address(temComs.host!) || ipAdapter!.isIPv6Address(temComs.host!) ){ + temComs.path = "/\(bucketName)" + } + } + + return temComs.string! + } +} diff --git a/Supporting Files/AliyunOSSiOS.h b/Supporting Files/AliyunOSSiOS.h index 2999ca95..e638560b 100644 --- a/Supporting Files/AliyunOSSiOS.h +++ b/Supporting Files/AliyunOSSiOS.h @@ -19,3 +19,4 @@ FOUNDATION_EXPORT const unsigned char AliyunOSSiOSVersionString[]; #import "OSSService.h" #import "OSSCompat.h" #import "OSSXMLDictionary.h" +#import "OSSIPv6Adapter.h" From a72d9e2bc6dd905e43125ac9eebf96cf00f32924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Mon, 23 Dec 2019 10:17:52 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AliyunOSSSDK/OSSDefine.h | 2 +- AliyunOSSiOS.podspec | 2 +- CHANGLOG.txt | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/AliyunOSSSDK/OSSDefine.h b/AliyunOSSSDK/OSSDefine.h index 0dce7c9f..e90105a2 100644 --- a/AliyunOSSSDK/OSSDefine.h +++ b/AliyunOSSSDK/OSSDefine.h @@ -16,7 +16,7 @@ #elif TARGET_OS_OSX #define OSSUAPrefix @"aliyun-sdk-mac" #endif -#define OSSSDKVersion @"2.10.7" +#define OSSSDKVersion @"2.10.8" #define OSSListBucketResultXMLTOKEN @"ListBucketResult" #define OSSNameXMLTOKEN @"Name" diff --git a/AliyunOSSiOS.podspec b/AliyunOSSiOS.podspec index b0701aea..80b0585f 100644 --- a/AliyunOSSiOS.podspec +++ b/AliyunOSSiOS.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = "AliyunOSSiOS" - s.version = "2.10.7" + s.version = "2.10.8" s.summary = "An iOS SDK for Aliyun Object Storage Service" diff --git a/CHANGLOG.txt b/CHANGLOG.txt index bb2ecbb3..25864a59 100755 --- a/CHANGLOG.txt +++ b/CHANGLOG.txt @@ -15,6 +15,12 @@ pod dependency: pod 'AliyunOSSiOS' Update Logs: +2019/12/23 +- release 2.10.8 +1.modify the filter rules about bucketname. +2.modify the filter rules about endpoint. + + 2018/09/13 - release 2.10.7 1.refactor code of building canonical url for request,Keep its logic consistent with android sdk. From bd48e1f03e6e327b15785b13116417536b150d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Mon, 23 Dec 2019 14:51:24 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AliyunOSSiOSTests/OSSUtilsTests.m | 19 ++++++++++++++-- CHANGLOG.txt | 2 +- .../OSSSwiftDemoTests/OSSUtilsTests.swift | 22 +++++++++++++++++++ README-CN.md | 2 -- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/AliyunOSSiOSTests/OSSUtilsTests.m b/AliyunOSSiOSTests/OSSUtilsTests.m index 05ba232e..15c315ed 100644 --- a/AliyunOSSiOSTests/OSSUtilsTests.m +++ b/AliyunOSSiOSTests/OSSUtilsTests.m @@ -72,17 +72,32 @@ - (void)testPerformanceExample { } - (void)testBucketName{ - ///^[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]$" + BOOL result1 = [OSSUtil validateBucketName:@"123-456abc"]; XCTAssertTrue(result1); - BOOL result2 = [OSSUtil validateBucketName:@"123-456abc-"]; + + BOOL result2 = [OSSUtil validateBucketName:@"123-456abc*"]; XCTAssertFalse(result2); + BOOL result3 = [OSSUtil validateBucketName:@"-123-456abc"]; XCTAssertFalse(result3); + BOOL result4 = [OSSUtil validateBucketName:@"123\\456abc"]; XCTAssertFalse(result4); + BOOL result5 = [OSSUtil validateBucketName:@"abc123"]; + XCTAssertTrue(result5); + + BOOL result6 = [OSSUtil validateBucketName:@"abc_123"]; + XCTAssertFalse(result6); + + BOOL result7 = [OSSUtil validateBucketName:@"a"]; + XCTAssertFalse(result7); + + BOOL result8 = [OSSUtil validateBucketName:@"abcdefghig-abcdefghig-abcdefghig-abcdefghig-abcdefghig-abcdefghig"]; + XCTAssertFalse(result8); + } diff --git a/CHANGLOG.txt b/CHANGLOG.txt index 25864a59..952cbc14 100755 --- a/CHANGLOG.txt +++ b/CHANGLOG.txt @@ -16,7 +16,7 @@ pod dependency: pod 'AliyunOSSiOS' Update Logs: 2019/12/23 -- release 2.10.8 +- release 3.0.0 1.modify the filter rules about bucketname. 2.modify the filter rules about endpoint. diff --git a/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift b/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift index c13e49f4..4dd1c4a6 100644 --- a/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift +++ b/OSSSwiftDemo/OSSSwiftDemoTests/OSSUtilsTests.swift @@ -25,25 +25,47 @@ class OSSUtilsTests: XCTestCase { func testBucketName(){ ///^[a-z0-9][a-z0-9\\-]{1,61}[a-z0-9]$" + let result1 = OSSUtil.validateBucketName("123-456abc") XCTAssertTrue(result1) + let result2 = OSSUtil.validateBucketName("123-456abc-") XCTAssertFalse(result2) + let result3 = OSSUtil.validateBucketName("-123-456abc") XCTAssertFalse(result3) + let str4 = String("123\\456abc") let result4 = OSSUtil.validateBucketName(str4) XCTAssertFalse(result4) + + let result5 = OSSUtil.validateBucketName("abc123") + XCTAssertTrue(result5) + + let result6 = OSSUtil.validateBucketName("abc_123") + XCTAssertFalse(result6) + + let result7 = OSSUtil.validateBucketName("a") + XCTAssertFalse(result7) + + let str8 = String("abcdefghig-abcdefghig-abcdefghig-abcdefghig-abcdefghig-abcdefghig") + let result8 = OSSUtil.validateBucketName(str8) + XCTAssertFalse(result8) + } func testEndpoint(){ let bucketName = "test-image" + let result1 = getResultEndpoint(endpoint: "http://123.test:8989/path?ooob") XCTAssertTrue((result1 == "http://123.test:8989")) + let result2 = getResultEndpoint(endpoint: "http://192.168.0.1:8081") XCTAssertTrue((result2 == "http://192.168.0.1:8081/\(bucketName)")) + let result3 = getResultEndpoint(endpoint: "http://192.168.0.1") XCTAssertTrue((result3 == "http://192.168.0.1/\(bucketName)")) + let result4 = getResultEndpoint(endpoint: "http://oss-cn-region.aliyuncs.com") XCTAssertTrue((result4 == "http://\(bucketName).oss-cn-region.aliyuncs.com")) } diff --git a/README-CN.md b/README-CN.md index d4b1638e..e1e37779 100644 --- a/README-CN.md +++ b/README-CN.md @@ -243,8 +243,6 @@ SDK提供进阶的上传、下载功能、断点续传,以及文件管理、Bu ![list1](https://github.com/aliyun/aliyun-oss-ios-sdk/blob/master/Images/list1.png) - - ## License * Apache License 2.0. From 079edc0a55d77819beb643ae4b272580be75269a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Mon, 23 Dec 2019 14:56:31 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGLOG.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGLOG.txt b/CHANGLOG.txt index 952cbc14..ff55d13d 100755 --- a/CHANGLOG.txt +++ b/CHANGLOG.txt @@ -1,4 +1,4 @@ -Aliyun Open Services SDK for iOS +2Aliyun Open Services SDK for iOS Copyright (C) Alibaba Cloud Computing All rights reserved. @@ -16,7 +16,7 @@ pod dependency: pod 'AliyunOSSiOS' Update Logs: 2019/12/23 -- release 3.0.0 +- release 2.10.8 1.modify the filter rules about bucketname. 2.modify the filter rules about endpoint. From fcafcdb8911ad107cfc2f44fab19392af0f6721c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90?= Date: Mon, 23 Dec 2019 15:19:24 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=BA=A0=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGLOG.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGLOG.txt b/CHANGLOG.txt index ff55d13d..25864a59 100755 --- a/CHANGLOG.txt +++ b/CHANGLOG.txt @@ -1,4 +1,4 @@ -2Aliyun Open Services SDK for iOS +Aliyun Open Services SDK for iOS Copyright (C) Alibaba Cloud Computing All rights reserved.