Skip to content

Commit edb13f6

Browse files
committed
httpserver: Fix incorrect path joining
1 parent e782421 commit edb13f6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ def dirize(self, filename):
941941
if os.path.isabs(filename):
942942
filename = os.path.abspath(filename)
943943
selfAbs = os.path.abspath(myself)
944-
commonPrefix = os.path.commonprefix([selfAbs, filename])
944+
commonPrefix = os.path.commonpath([selfAbs, filename])
945945
filename = filename[len(commonPrefix):]
946946
elif not os.path.isabs(myself):
947947
if filename.startswith(myself):

src/httpserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def __init__(self, mimetype='text/plain; charset=utf-8'):
337337
super(Static, self).__init__()
338338
self._mimetype = mimetype
339339
def doGetOrHead(self, handler, path, write_content):
340-
response = get_template(path)
340+
response = get_template(path[1:]) # strip leading /
341341
if minisix.PY3:
342342
response = response.encode()
343343
handler.send_response(200)

0 commit comments

Comments
 (0)