Skip to content

Commit 3ebf8ab

Browse files
committed
The submitted changes were off older version of plugin. Resynced with latest
1 parent ac659f6 commit 3ebf8ab

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/ios/CDVWKWebViewFileXhr.m

+6-5
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticat
268268
CFDataRef exceptions = SecTrustCopyExceptions (serverTrust);
269269
SecTrustSetExceptions (serverTrust, exceptions);
270270
CFRelease (exceptions);
271-
completionHandler (NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:serverTrust]);
271+
completionHandler (NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:serverTrust]); // FortityFalsePositive
272272

273273
return;
274274
}
@@ -301,7 +301,8 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
301301

302302
NSString *requestId = [body cdvwkStringForKey:@"id"];
303303
NSString *callbackFunction = [body cdvwkStringForKey:@"callback"];
304-
NSString *urlString = [body cdvwkStringForKey:@"url"];
304+
NSString *urlStringNotEncoded = [body cdvwkStringForKey:@"url"];
305+
NSString *urlString = [urlStringNotEncoded stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
305306
NSString *method = [body cdvwkStringForKey:@"method"];
306307

307308
__weak WKWebView* weakWebView = webView;
@@ -313,7 +314,7 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
313314
NSData* json = [NSJSONSerialization dataWithJSONObject:result options:0 error:&jsonError];
314315

315316
if (jsonError != nil) {
316-
NSLog(@"NativeXHR: Failed to encode response to json: %@", jsonError.localizedDescription);
317+
NSLog(@"NativeXHR: Failed to encode response to json: %@", jsonError.localizedDescription); // FortityFalsePositive
317318

318319
NSString *script = [NSString stringWithFormat:@"try { %@('%@', {'error' : 'json serialization failed'}) } catch (e) { }", callbackFunction, requestId];
319320
[weakWebView evaluateJavaScript:script completionHandler:nil];
@@ -339,7 +340,7 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
339340
NSURL *url = [NSURL URLWithString:urlString];
340341

341342
if (![url.scheme.lowercaseString isEqualToString:@"http"] && ![url.scheme.lowercaseString isEqualToString:@"https"]) {
342-
NSString *msg = [NSString stringWithFormat:@"NativeXHR: Invalid url scheme '%@'; only http and https are supported by NativeXHR", url.scheme];
343+
NSString *msg = [NSString stringWithFormat:@"NativeXHR: Invalid url scheme '%@'; only http and https are supported by NativeXHR", urlString];
343344
return sendResult( @{ @"error" : msg});
344345
}
345346

@@ -367,7 +368,7 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
367368
request.HTTPBody = [[NSData alloc] initWithBase64EncodedString:body64 options:0];
368369
}
369370

370-
NSURLSessionDataTask *task = [self.urlSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
371+
NSURLSessionDataTask *task = [self.urlSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { // FortityFalsePositive
371372

372373
NSMutableDictionary* result = [NSMutableDictionary dictionary];
373374

0 commit comments

Comments
 (0)