Skip to content

Commit

Permalink
Merge pull request #156 from RicoYao/auth_view_controller_block_file_…
Browse files Browse the repository at this point in the history
…scheme

Block URLs with "file" scheme from loading in authorization webview.
  • Loading branch information
Rico Yao committed Dec 30, 2015
2 parents c1b3828 + d1aa904 commit 7bc69bd
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -307,16 +307,21 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
// which would (probably erroneously) first load about:blank, then attempt to load its icon. The web view would
// fail to load about:blank, which would cause the whole page to not appear. So we realized that we can and should
// generally protect against loading about:blank.
if ([request.URL isEqual:[NSURL URLWithString:@"about:blank"]]) {
if ([[request.URL.absoluteString lowercaseString] isEqualToString:@"about:blank"]) {
return NO;
}

// Mailto URLs can be encountered if there is a hyperlink for sending an email.
if ([[[request URL] scheme] isEqual:@"mailto"]) {
if ([[[[request URL] scheme] lowercaseString] isEqualToString:@"mailto"]) {
[[UIApplication sharedApplication] openURL:[request URL]];
return NO;
}

// Never load file:// urls.
if ([[request URL] isFileURL]) {
return NO;
}

[self.activityIndicator startAnimating];

// Figure out whether this request is the redirect used at the end of the authentication process
Expand Down

0 comments on commit 7bc69bd

Please sign in to comment.