mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-28 22:41:05 -05:00
httpserver: Fix incorrect path joining
This commit is contained in:
parent
e7824213ae
commit
edb13f65df
@ -941,7 +941,7 @@ class Directory(registry.String):
|
|||||||
if os.path.isabs(filename):
|
if os.path.isabs(filename):
|
||||||
filename = os.path.abspath(filename)
|
filename = os.path.abspath(filename)
|
||||||
selfAbs = os.path.abspath(myself)
|
selfAbs = os.path.abspath(myself)
|
||||||
commonPrefix = os.path.commonprefix([selfAbs, filename])
|
commonPrefix = os.path.commonpath([selfAbs, filename])
|
||||||
filename = filename[len(commonPrefix):]
|
filename = filename[len(commonPrefix):]
|
||||||
elif not os.path.isabs(myself):
|
elif not os.path.isabs(myself):
|
||||||
if filename.startswith(myself):
|
if filename.startswith(myself):
|
||||||
|
@ -337,7 +337,7 @@ class Static(SupyHTTPServerCallback):
|
|||||||
super(Static, self).__init__()
|
super(Static, self).__init__()
|
||||||
self._mimetype = mimetype
|
self._mimetype = mimetype
|
||||||
def doGetOrHead(self, handler, path, write_content):
|
def doGetOrHead(self, handler, path, write_content):
|
||||||
response = get_template(path)
|
response = get_template(path[1:]) # strip leading /
|
||||||
if minisix.PY3:
|
if minisix.PY3:
|
||||||
response = response.encode()
|
response = response.encode()
|
||||||
handler.send_response(200)
|
handler.send_response(200)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user