Insert gemini protocol into host-only URLs

This commit is contained in:
Shadowfacts 2020-12-20 15:32:36 -05:00
parent e27ac15635
commit 71831e58f2
1 changed files with 5 additions and 2 deletions

View File

@ -77,8 +77,11 @@ class NavigationBarView: UIView {
@objc private func commitURL() { @objc private func commitURL() {
textField.resignFirstResponder() textField.resignFirstResponder()
if let text = textField.text, let url = URL(string: text) { if let text = textField.text, var components = URLComponents(string: text) {
navigator.changeURL(url) if components.scheme == nil {
components.scheme = "gemini"
}
navigator.changeURL(components.url!)
} else { } else {
textField.text = navigator.displayURL textField.text = navigator.displayURL
} }