fix searching/url loading

This commit is contained in:
Izalia Mae 2023-01-29 08:47:23 -05:00
parent 7ef8bf60af
commit f22e7b1a35

View file

@ -501,7 +501,6 @@ class WebTab(BuilderBase, Gtk.Box):
def handle_load_url(self, full_url):
keyword = None
address = None
with self.db.session as s:
if Path(full_url).exists():
@ -542,23 +541,20 @@ class WebTab(BuilderBase, Gtk.Box):
## Is the url.domain an actual domain?
if not keyword:
try:
address = Address(resolve_address(url.domain))
Address(resolve_address(url.domain))
logging.verbose('Url without protocol')
if address.is_type('private'):
url = url.replace_properties(
proto = 'http',
port = 80 if url.port == 443 else url.port
)
except (NXDOMAIN, NoAnswer):
return run_in_gui_thread(self.window.notification, f'Failed to resolve domain: {url.domain}')
search = s.get_search(keyword, default=True)
logging.verbose('Keyword search:', search.keyword)
url = search.compile(full_url)
if not address:
search = s.get_search(keyword, default=True)
logging.verbose('Keyword search:', search.keyword)
url = search.compile(full_url)
## this is broken :/
# try:
# url.top
# except ValueError:
# url = url.replace_property('proto', 'http')
run_in_gui_thread(self.webview.load_uri, url)