Skip to content

Commit

Permalink
Merge pull request #27 from igtm/encodeurl
Browse files Browse the repository at this point in the history
[fix] encode resourceURL
  • Loading branch information
pichillilorenzo authored Dec 20, 2018
2 parents a2b7e48 + 7dc2935 commit 3b53810
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ios/Classes/InAppBrowserWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,9 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU
}
else if message.name == "resourceLoaded" && (webViewOptions?.useOnLoadResource)! {
if let resource = convertToDictionary(text: message.body as! String) {
let url = URL(string: resource["name"] as! String)!
let rawUrl = resource["name"] as! String
let encodedUrl = rawUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: encodedUrl)!
if !UIApplication.shared.canOpenURL(url) {
return
}
Expand Down

0 comments on commit 3b53810

Please sign in to comment.