Repos / mcross / 7bc4e56bcb
commit 7bc4e56bcbabdf71b832ff04f943eda9310cc5ad
Author: Bùi Thành Nhân <hi@imnhan.com>
Date:   Sun May 31 10:09:32 2020 +0700

    fix bug when visiting relative url from root
    
    https://todo.sr.ht/~nhanb/mcross/6

diff --git a/src/mcross/transport.py b/src/mcross/transport.py
index 7c7071a..9031cc9 100644
--- a/src/mcross/transport.py
+++ b/src/mcross/transport.py
@@ -91,6 +91,8 @@ def parse(cls, text, current_url):
         #   raw url text: yikes
         #   => parsed url: gemini://example.com/foo/yikes
         current_path = current_url.path[: current_url.path.rfind("/") + 1]
+        if current_path == "":
+            current_path = "/"
         return GeminiUrl(current_url.host, current_url.port, current_path + text)
 
     @staticmethod