solve two gopher bugs related to path
This commit is contained in:
parent
fb29a83cc6
commit
aa8e0cdb3e
10
offpunk.py
10
offpunk.py
|
@ -927,8 +927,7 @@ class GeminiItem():
|
||||||
else:
|
else:
|
||||||
itemtype = "1"
|
itemtype = "1"
|
||||||
selector = parsed.path
|
selector = parsed.path
|
||||||
itemtype = parsed.path[1]
|
self.path = selector
|
||||||
self.path = parsed.path[2:]
|
|
||||||
else:
|
else:
|
||||||
itemtype = "1"
|
itemtype = "1"
|
||||||
self.path = parsed.path
|
self.path = parsed.path
|
||||||
|
@ -1214,7 +1213,9 @@ class GeminiItem():
|
||||||
return self.mime
|
return self.mime
|
||||||
elif self.is_cache_valid():
|
elif self.is_cache_valid():
|
||||||
path = self.get_cache_path()
|
path = self.get_cache_path()
|
||||||
if path.endswith(".gmi"):
|
if os.path.isdir(path):
|
||||||
|
mime = "Local Folder"
|
||||||
|
elif path.endswith(".gmi"):
|
||||||
mime = "text/gemini"
|
mime = "text/gemini"
|
||||||
elif _HAS_MAGIC :
|
elif _HAS_MAGIC :
|
||||||
mime = magic.from_file(path,mime=True)
|
mime = magic.from_file(path,mime=True)
|
||||||
|
@ -1276,6 +1277,8 @@ class GeminiItem():
|
||||||
# Get rid of bottom component
|
# Get rid of bottom component
|
||||||
pathbits.pop()
|
pathbits.pop()
|
||||||
new_path = os.path.join(*pathbits)
|
new_path = os.path.join(*pathbits)
|
||||||
|
if self.scheme == "gopher":
|
||||||
|
new_path = "/1" + new_path
|
||||||
return GeminiItem(self._derive_url(new_path))
|
return GeminiItem(self._derive_url(new_path))
|
||||||
|
|
||||||
def query(self, query):
|
def query(self, query):
|
||||||
|
@ -2608,6 +2611,7 @@ Think of it like marks in vi: 'mark a'='ma' and 'go a'=''a'."""
|
||||||
"""Display information about current page."""
|
"""Display information about current page."""
|
||||||
out = self.gi.full_title() + "\n\n"
|
out = self.gi.full_title() + "\n\n"
|
||||||
out += "URL : " + self.gi.url + "\n"
|
out += "URL : " + self.gi.url + "\n"
|
||||||
|
out += "Path : " + self.gi.path + "\n"
|
||||||
out += "Mime : " + self.gi.get_mime() + "\n"
|
out += "Mime : " + self.gi.get_mime() + "\n"
|
||||||
out += "Cache : " + self.gi.get_cache_path() + "\n"
|
out += "Cache : " + self.gi.get_cache_path() + "\n"
|
||||||
if self.gi.renderer :
|
if self.gi.renderer :
|
||||||
|
|
Loading…
Reference in New Issue