This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def safe_join(directory, *pathnames): | |
pathnames = tuple(posixpath.normpath(p) for p in pathnames) | |
for filename in pathnames: | |
for sep in _os_alt_seps: | |
if sep in filename: | |
raise NotFound() | |
if os.path.isabs(filename) or \ | |
filename == '..' or \ | |
filename.startswith('../'): | |
raise NotFound() |