Fix bug in path handling

This commit is contained in:
Michael Lazar 2019-08-06 23:47:11 -04:00
parent ccee54b448
commit 255e67457a
1 changed files with 1 additions and 1 deletions

View File

@ -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