commit 8c59ce7759ca4763311f20a6da25b16558421386
parent 123c73b4e06c89781543dfcba55581d6a3931129
Author: Natalie Pendragon <natpen@natpen.net>
Date: Tue, 19 May 2020 09:30:08 -0400
Don't attempt local file reads
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gusmobile/client.py b/gusmobile/client.py
@@ -55,15 +55,17 @@ class Response:
self.prompt = prompt
-def fetch(url):
+def fetch(raw_url):
# Do everything which touches the network in one block,
# so we only need to catch exceptions once
- url = urllib.parse.urlparse(url, 'gemini')
+ url = urllib.parse.urlparse(raw_url, 'gemini')
header = ""
try:
# Is this a local file?
if not url.netloc:
- address, f = None, open(url.path, "rb")
+ print("ERROR: {} parses with no netloc".format(raw_url))
+ f.close()
+ return
else:
address, f = _send_request(url)
# Read response header