Return 404 error when path can't be translated
This commit is contained in:
parent
00ec48f214
commit
8c411ceb70
@ -144,6 +144,10 @@ class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
** [dcbw] modified to send Content-disposition filename too
|
** [dcbw] modified to send Content-disposition filename too
|
||||||
"""
|
"""
|
||||||
path = self.translate_path(self.path)
|
path = self.translate_path(self.path)
|
||||||
|
if not path or not os.path.exists(path):
|
||||||
|
self.send_error(404, "File not found")
|
||||||
|
return None
|
||||||
|
|
||||||
f = None
|
f = None
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
for index in "index.html", "index.htm":
|
for index in "index.html", "index.htm":
|
||||||
|
Loading…
Reference in New Issue
Block a user