Open URL without http or https prefix
This commit is contained in:
parent
3ca7b71f4a
commit
ced3142291
1 changed files with 5 additions and 1 deletions
|
|
@ -401,7 +401,11 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
|||
}
|
||||
|
||||
func openLink() {
|
||||
guard let urlString = self.password?.getURLString(), let url = URL(string: urlString) else {
|
||||
var urlString = self.password?.getURLString() ?? ""
|
||||
if !urlString.lowercased().starts(with: "https://") && !urlString.lowercased().starts(with: "http://") {
|
||||
urlString = "http://\(urlString)"
|
||||
}
|
||||
guard let url = URL(string: urlString) else {
|
||||
DispatchQueue.main.async {
|
||||
Utils.alert(title: "Error", message: "Cannot find a valid URL", controller: self, completion: nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue