commit 9e6fecc0d888c3e5d27dca77fc034679994b394e
parent 998b25cdb69581c5f98395c39df325bffe0e5178
Author: solderpunk <solderpunk@sdf.org>
Date: Sun, 6 Oct 2019 10:36:07 -0400
Merge branch 'master' of lel/AV-98 into master
Diffstat:
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/av98.py b/av98.py
@@ -110,13 +110,10 @@ class GeminiItem():
return GeminiItem(self._derive_url("/"))
def up(self):
- pathbits = list(os.path.split(self.path))
- # Get rid of empty string from trailing /
- while not pathbits[-1]:
- pathbits.pop()
+ pathbits = list(os.path.split(self.path.rstrip('/')))
# Don't try to go higher than root
if len(pathbits) == 1:
- return self.url
+ return self
# Get rid of bottom component
pathbits.pop()
new_path = os.path.join(*pathbits)
@@ -153,9 +150,9 @@ class GeminiItem():
def to_map_line(self, name=None):
if name or self.name:
- return "=> {} {}".format(self.url, name or self.name)
+ return "=> {} {}\n".format(self.url, name or self.name)
else:
- return "=> {}".format(self.url)
+ return "=> {}\n".format(self.url)
@classmethod
def from_map_line(cls, line, origin_gi):