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) self.window.addstr(command_char + prefix)
curses.curs_set(1) curses.curs_set(1)
try: try:
command = self.textbox.edit(validator)[1:] command = self.textbox.edit(validator)[1:].strip()
except EscapeCommandInterrupt: except EscapeCommandInterrupt:
command = "" command = ""
except TerminateCommandInterrupt as exc: except TerminateCommandInterrupt as exc:

View file

@ -20,7 +20,7 @@ def parse_url(url: str, absolute: bool =False):
if url.startswith("gemini://"): if url.startswith("gemini://"):
url = url[7:] url = url[7:]
parts = urllib.parse.urlparse(url, scheme="gemini") 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") parts = urllib.parse.urlparse(f"//{url}", scheme="gemini")
return parts return parts

View file

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