Simplify trailing slash handling to make going up work

This commit is contained in:
lel 2019-09-28 03:28:01 -04:00
parent 7997c40e94
commit 210d0459eb
1 changed files with 1 additions and 4 deletions

View File

@ -110,10 +110,7 @@ class GeminiItem():
return GeminiItem(self._derive_url("/"))
def up(self):
pathbits = list(os.path.split(self.path))
# Get rid of empty string from trailing /
if 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