Fix bug in path handling
This commit is contained in:
parent
ccee54b448
commit
255e67457a
|
@ -94,7 +94,7 @@ class StaticDirectoryApp:
|
|||
url_path = pathlib.Path(self.environ["PATH_INFO"].strip("/"))
|
||||
|
||||
filename = pathlib.Path(os.path.normpath(str(url_path)))
|
||||
if filename.is_absolute() or filename.parts[0] == "..":
|
||||
if filename.is_absolute() or str(filename.name).startswith(".."):
|
||||
# Guard against breaking out of the directory
|
||||
self.send_status(STATUS_NOT_FOUND, "Not Found")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue