@@ -491,7 +491,7 @@ - (void)testUniversalLink_NoDeepLink {
491
491
// https://a.firebase.com/mypath
492
492
- (void )testDynamicLinkFromUniversalLinkURLWithCustomDomainLink {
493
493
self.service = [[FIRDynamicLinks alloc ] init ];
494
- NSString *durableDeepLinkString = @" https://a.firebase.com/mypath/?link=abcd" ;
494
+ NSString *durableDeepLinkString = @" https://a.firebase.com/mypath/?link=http:// abcd" ;
495
495
NSURL *durabledeepLinkURL = [NSURL URLWithString: durableDeepLinkString];
496
496
497
497
SwizzleDynamicLinkNetworkingWithMock ();
@@ -501,14 +501,14 @@ - (void)testDynamicLinkFromUniversalLinkURLWithCustomDomainLink {
501
501
XCTAssertNotNil (dynamicLink);
502
502
NSString *deepLinkURLString = dynamicLink.url .absoluteString ;
503
503
504
- XCTAssertEqualObjects (@" abcd" , deepLinkURLString,
504
+ XCTAssertEqualObjects (@" http:// abcd" , deepLinkURLString,
505
505
@" ddl url parameter and deep link url should be the same" );
506
506
UnswizzleDynamicLinkNetworking ();
507
507
}
508
508
509
509
- (void )testDynamicLinkFromUniversalLinkURLCompletionWithCustomDomainLink {
510
510
self.service = [[FIRDynamicLinks alloc ] init ];
511
- NSString *durableDeepLinkString = @" https://a.firebase.com/mypath/?link=abcd" ;
511
+ NSString *durableDeepLinkString = @" https://a.firebase.com/mypath/?link=http:// abcd" ;
512
512
NSURL *durabledeepLinkURL = [NSURL URLWithString: durableDeepLinkString];
513
513
514
514
SwizzleDynamicLinkNetworkingWithMock ();
@@ -523,7 +523,7 @@ - (void)testDynamicLinkFromUniversalLinkURLCompletionWithCustomDomainLink {
523
523
NSString *deepLinkURLString = dynamicLink.url .absoluteString ;
524
524
525
525
XCTAssertEqualObjects (
526
- @" abcd" , deepLinkURLString,
526
+ @" http:// abcd" , deepLinkURLString,
527
527
@" ddl url parameter and deep link url should be the same" );
528
528
[expectation fulfill ];
529
529
}];
@@ -1099,9 +1099,23 @@ - (void)testResolveLinkRespectsResponseErrorStatusCode {
1099
1099
[self waitForExpectationsWithTimeout: kAsyncTestTimout handler: nil ];
1100
1100
}
1101
1101
1102
- - (void )testMatchesShortLinkFormat {
1103
- NSArray <NSString *> *urlStrings =
1104
- @[ @" https://test.app.goo.gl/xyz" , @" https://test.app.goo.gl/xyz?link=" ];
1102
+ - (void )testPassMatchesShortLinkFormatForDDLDomains {
1103
+ NSArray <NSString *> *urlStrings = @[
1104
+ @" https://someapp.app.goo.gl/somepath" , @" https://someapp.app.goo.gl/link" ,
1105
+ @" https://someapp.app.goo.gl/somepath?link=https://somedomain" ,
1106
+ @" https://someapp.app.goo.gl/somepath?somekey=somevalue" ,
1107
+ @" https://someapp.app.goo.gl/somepath/?link=https://somedomain" ,
1108
+ @" https://someapp.app.goo.gl/somepath/?somekey=somevalue" ,
1109
+ @" https://someapp.page.link/somepath" , @" https://someapp.page.link/link" ,
1110
+ @" https://someapp.page.link/somepath?link=https://somedomain" ,
1111
+ @" https://someapp.page.link/somepath?somekey=somevalue" ,
1112
+ @" https://someapp.page.link/somepath/?link=https://somedomain" ,
1113
+ @" https://someapp.page.link/somepath/?somekey=somevalue" , @" http://someapp.page.link/somepath" ,
1114
+ @" http://someapp.page.link/link" , @" http://someapp.page.link/somepath?link=https://somedomain" ,
1115
+ @" http://someapp.page.link/somepath?somekey=somevalue" ,
1116
+ @" http://someapp.page.link/somepath/?link=http://somedomain" ,
1117
+ @" http://someapp.page.link/somepath/?somekey=somevalue"
1118
+ ];
1105
1119
1106
1120
for (NSString *urlString in urlStrings) {
1107
1121
NSURL *url = [NSURL URLWithString: urlString];
@@ -1112,16 +1126,36 @@ - (void)testMatchesShortLinkFormat {
1112
1126
}
1113
1127
}
1114
1128
1115
- // Custom domain entries in plist file:
1116
- // https://google.com
1117
- // https://google.com/one
1118
- // https://a.firebase.com/mypath
1119
- - (void )testFailMatchesShortLinkFormatForCustomDomains {
1129
+ - (void )testFailMatchesShortLinkFormat {
1120
1130
NSArray <NSString *> *urlStrings = @[
1121
- @" https://google.com" ,
1122
- @" https://google.com?link=" ,
1123
- @" https://a.firebase.com" ,
1124
- @" https://a.firebase.com/mypath?link=" ,
1131
+ @" https://someapp.app.goo.gl" ,
1132
+ @" https://someapp.app.goo.gl/" ,
1133
+ @" https://someapp.app.goo.gl?" ,
1134
+ @" https://someapp.app.goo.gl/?" ,
1135
+ @" https://someapp.app.goo.gl?somekey=somevalue" ,
1136
+ @" https://someapp.app.goo.gl/?somekey=somevalue" ,
1137
+ @" https://someapp.app.goo.gl/somepath/somepath2" ,
1138
+ @" https://someapp.app.goo.gl/somepath/somepath2?somekey=somevalue" ,
1139
+ @" https://someapp.app.goo.gl/somepath/somepath2?link=https://somedomain" ,
1140
+ @" https://someapp.page.link" ,
1141
+ @" https://someapp.page.link/" ,
1142
+ @" https://someapp.page.link?" ,
1143
+ @" https://someapp.page.link/?" ,
1144
+ @" https://someapp.page.link?somekey=somevalue" ,
1145
+ @" https://someapp.page.link/?somekey=somevalue" ,
1146
+ @" https://someapp.page.link/somepath/somepath2" ,
1147
+ @" https://someapp.page.link/somepath/somepath2?somekey=somevalue" ,
1148
+ @" https://someapp.page.link/somepath/somepath2?link=https://somedomain" ,
1149
+ @" https://www.google.com/maps/place/@1,1/My+Home/" ,
1150
+ @" https://mydomain.com/t439gfde" ,
1151
+ @" https://goo.gl/309dht4" ,
1152
+ @" https://59eh.goo.gl/309dht4" ,
1153
+ @" https://app.59eh.goo.gl/309dht4" ,
1154
+ @" https://goo.gl/i/309dht4" ,
1155
+ @" https://page.link/i/309dht4" ,
1156
+ @" https://fjo3eh.goo.gl/i/309dht4" ,
1157
+ @" https://app.fjo3eh.goo.gl/i/309dht4" ,
1158
+ @" https://1234.page.link/link/dismiss"
1125
1159
];
1126
1160
1127
1161
for (NSString *urlString in urlStrings) {
@@ -1137,27 +1171,41 @@ - (void)testFailMatchesShortLinkFormatForCustomDomains {
1137
1171
// https://google.com
1138
1172
// https://google.com/one
1139
1173
// https://a.firebase.com/mypath
1140
- - (void )testPassMatchesShortLinkFormatForCustomDomains {
1174
+ - (void )testFailMatchesShortLinkFormatForCustomDomains {
1141
1175
NSArray <NSString *> *urlStrings = @[
1142
- @" https://google.com/xyz" , @" https://google.com/xyz/?link=" , @" https://google.com/xyz?link=" ,
1143
- @" https://google.com/one/xyz" , @" https://google.com/one/xyz?link=" ,
1144
- @" https://google.com/one?utm_campaignlink=" , @" https://google.com/mylink" ,
1145
- @" https://google.com/one/mylink" , @" https://a.firebase.com/mypath/mylink"
1176
+ @" https://google.com" ,
1177
+ @" https://a.firebase.com" ,
1178
+ @" https://google.com/" ,
1179
+ @" https://google.com?" ,
1180
+ @" https://google.com/?" ,
1181
+ @" https://google.com?utm_campgilink=someval" ,
1182
+ @" https://google.com?somekey=someval" ,
1146
1183
];
1147
1184
1148
1185
for (NSString *urlString in urlStrings) {
1149
1186
NSURL *url = [NSURL URLWithString: urlString];
1150
1187
BOOL matchesShortLinkFormat = [self .service matchesShortLinkFormat: url];
1151
1188
1152
- XCTAssertTrue (matchesShortLinkFormat,
1153
- @" Non-DDL domain URL matched short link format with URL: %@ " , url);
1189
+ XCTAssertFalse (matchesShortLinkFormat,
1190
+ @" Non-DDL domain URL matched short link format with URL: %@ " , url);
1154
1191
}
1155
1192
}
1156
1193
1157
- - (void )testPassMatchesShortLinkFormat {
1194
+ // Custom domain entries in plist file:
1195
+ // https://google.com
1196
+ // https://google.com/one
1197
+ // https://a.firebase.com/mypath
1198
+ - (void )testPassMatchesShortLinkFormatForCustomDomains {
1158
1199
NSArray <NSString *> *urlStrings = @[
1159
- @" https://test.app.goo.gl/xyz" ,
1160
- @" https://test.app.goo.gl/xyz?link=" ,
1200
+ @" https://google.com/xyz" , @" https://google.com/xyz/?link=https://somedomain" ,
1201
+ @" https://google.com?link=https://somedomain" , @" https://google.com/?link=https://somedomain" ,
1202
+ @" https://google.com/xyz?link=https://somedomain" ,
1203
+ @" https://google.com/xyz/?link=https://somedomain" , @" https://google.com/one/xyz" ,
1204
+ @" https://google.com/one/xyz?link=https://somedomain" ,
1205
+ @" https://google.com/one/xyz/?link=https://somedomain" ,
1206
+ @" https://google.com/one?utm_campaignlink=https://somedomain" ,
1207
+ @" https://google.com/one/?utm_campaignlink=https://somedomain" , @" https://google.com/mylink" ,
1208
+ @" https://google.com/one/mylink" , @" https://a.firebase.com/mypath/mylink"
1161
1209
];
1162
1210
1163
1211
for (NSString *urlString in urlStrings) {
@@ -1169,22 +1217,6 @@ - (void)testPassMatchesShortLinkFormat {
1169
1217
}
1170
1218
}
1171
1219
1172
- - (void )testFailMatchesShortLinkFormat {
1173
- NSArray <NSString *> *urlStrings = @[
1174
- @" https://test.app.goo.gl" , @" https://test.app.goo.gl?link=" , @" https://test.app.goo.gl/" ,
1175
- @" https://sample.page.link?link=https://google.com/test&ibi=com.google.sample&ius=79306483" ,
1176
- @" https://sample.page.link/?link=https://google.com/test&ibi=com.google.sample&ius=79306483"
1177
- ];
1178
-
1179
- for (NSString *urlString in urlStrings) {
1180
- NSURL *url = [NSURL URLWithString: urlString];
1181
- BOOL matchesShortLinkFormat = [self .service matchesShortLinkFormat: url];
1182
-
1183
- XCTAssertFalse (matchesShortLinkFormat,
1184
- @" Non-DDL domain URL matched short link format with URL: %@ " , url);
1185
- }
1186
- }
1187
-
1188
1220
- (void )testMatchesUnversalLinkWithShortDurableLink {
1189
1221
NSString *urlString = @" https://sample.page.link/79g49s" ;
1190
1222
NSURL *url = [NSURL URLWithString: urlString];
@@ -1520,14 +1552,22 @@ - (void)testValidCustomDomainNames {
1520
1552
NSArray <NSString *> *urlStrings = @[
1521
1553
@" https://google.com/mylink" , // Short FDL starting with 'https://google.com'
1522
1554
@" https://google.com/one" , // Short FDL starting with 'https://google.com'
1555
+ @" https://google.com/one/" , // Short FDL starting with 'https://google.com'
1556
+ @" https://google.com/one?" , // Short FDL starting with 'https://google.com'
1523
1557
@" https://google.com/one/mylink" , // Short FDL starting with 'https://google.com/one'
1524
1558
@" https://a.firebase.com/mypath/mylink" , // Short FDL starting https://a.firebase.com/mypath
1559
+ @" https://google.com?link=https://somedomain" , @" https://google.com/?link=https://somedomain" ,
1560
+ @" https://google.com/somepath?link=https://somedomain" ,
1561
+ @" https://google.com/somepath/?link=https://somedomain" ,
1562
+ @" https://google.com/somepath/somepath2?link=https://somedomain" ,
1563
+ @" https://google.com/somepath/somepath2/?link=https://somedomain" ,
1564
+ @" https://google.com/somepath?utm_campgilink=someval"
1525
1565
];
1526
1566
1527
1567
NSArray <NSString *> *longFDLURLStrings = @[
1528
- @" https://a.firebase.com/mypath/?link=abcd&test=1" , // Long FDL starting with
1529
- // https://a.firebase.com/mypath
1530
- @" https://google.com/?link=abcd" , // Long FDL starting with 'https://google.com'
1568
+ @" https://a.firebase.com/mypath/?link=https:// abcd&test=1" , // Long FDL starting with
1569
+ // https://a.firebase.com/mypath
1570
+ @" https://google.com/?link=http:// abcd" , // Long FDL starting with 'https://google.com'
1531
1571
];
1532
1572
for (NSString *urlString in urlStrings) {
1533
1573
NSURL *url = [NSURL URLWithString: urlString];
@@ -1550,17 +1590,17 @@ - (void)testInvalidCustomDomainNames {
1550
1590
// https://a.firebase.com/mypath
1551
1591
1552
1592
NSArray <NSString *> *urlStrings = @[
1553
- @" google.com" , // Valid domain. No scheme.
1554
- @" https://google.com" , // Valid domain. No path after domainURIPrefix.
1555
- @" https://google.com/" , // Valid domain. No path after domainURIPrefix.
1556
- @" https://google.com/one/ " , // Valid domain. No path after domainURIPrefix.
1557
- @" https://google .com/one/two/mylink " , // domainURIPrefix not exact match .
1558
- @" https://google.co.in/mylink " , // No matching domainURIPrefix.
1559
- @" https://firebase.com/mypath " , // No matching domainURIPrefix: Invalid (sub)domain .
1560
- @" https://b.firebase. com/mypath " , // No matching domainURIPrefix: Invalid subdomain .
1561
- @" https ://a.firebase.com/mypathabc " , // No matching domainURIPrefix: Invalid subdomain .
1562
- @" mydomain .com" , // https scheme not specified for domainURIPrefix.
1563
- @" http ://mydomain " , // Domain not in plist. No path after domainURIPrefix.
1593
+ @" google.com" , // Valid domain. No scheme.
1594
+ @" https://google.com" , // Valid domain. No path after domainURIPrefix.
1595
+ @" https://google.com/" , // Valid domain. No path after domainURIPrefix.
1596
+ @" https://google.co.in/mylink " , // No matching domainURIPrefix.
1597
+ @" https://firebase .com/mypath " , // No matching domainURIPrefix: Invalid (sub)domain .
1598
+ @" https://b.firebase.com/mypath " , // No matching domainURIPrefix: Invalid subdomain .
1599
+ @" https://a. firebase.com/mypathabc " , // No matching domainURIPrefix: Invalid subdomain .
1600
+ @" mydomain. com" , // https scheme not specified for domainURIPrefix .
1601
+ @" http ://mydomain " , // Domain not in plist. No path after domainURIPrefix .
1602
+ @" https://somecustom .com? " , @" https://somecustom.com/? " ,
1603
+ @" https ://somecustom.com?somekey=someval "
1564
1604
];
1565
1605
1566
1606
for (NSString *urlString in urlStrings) {
0 commit comments