navigation: fix minor issues with URLs

This commit is contained in:
dece 2021-02-16 21:23:06 +01:00
parent 85570de5a8
commit 657d46adc5
3 changed files with 3 additions and 3 deletions

View file

@ -33,7 +33,7 @@ class CommandLine:
self.window.addstr(command_char + prefix)
curses.curs_set(1)
try:
command = self.textbox.edit(validator)[1:]
command = self.textbox.edit(validator)[1:].strip()
except EscapeCommandInterrupt:
command = ""
except TerminateCommandInterrupt as exc:

View file

@ -20,7 +20,7 @@ def parse_url(url: str, absolute: bool =False):
if url.startswith("gemini://"):
url = url[7:]
parts = urllib.parse.urlparse(url, scheme="gemini")
if not parts.netloc and absolute:
if not parts.netloc or absolute:
parts = urllib.parse.urlparse(f"//{url}", scheme="gemini")
return parts

View file

@ -78,7 +78,7 @@ class Request:
try:
sock = socket.create_connection((hostname, port))
except socket.gaierror as exc:
except OSError as exc:
self.state = Request.STATE_CONNECTION_FAILED
self.error = exc.strerror
return False