From 3562a6db25d519eb153fcc9d6a7ab44b7056fb4a Mon Sep 17 00:00:00 2001 From: Solderpunk Date: Wed, 14 Aug 2019 21:16:46 +0300 Subject: [PATCH] Make sure absolutisation of https links works correctly! --- av98.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/av98.py b/av98.py index 2e4b8dd..a09504f 100755 --- 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):