commit 3562a6db25d519eb153fcc9d6a7ab44b7056fb4a
parent 1b7da02def0ab2cc89d6118719736e85e2e8781c
Author: Solderpunk <solderpunk@sdf.org>
Date: Wed, 14 Aug 2019 21:16:46 +0300
Make sure absolutisation of https links works correctly!
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/av98.py b/av98.py
@@ -139,9 +139,15 @@ class GeminiItem():
GeminiItem as a base.
"""
# Absolutise URL, which annoyingly needs a valid scheme...
- base_url = self.url.replace("gemini://", "https://")
+ if self.url.startswith("gemini://"):
+ base_url = self.url.replace("gemini://", "https://")
+ was_gemini = True
+ else:
+ base_url = self.url
+ was_gemini = False
absolute = urllib.parse.urljoin(base_url, relative_url)
- absolute = absolute.replace("https://", "gemini://")
+ if was_gemini:
+ absolute = absolute.replace("https://", "gemini://")
return absolute
def to_map_line(self, name=None):