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("/"))
 | 
					        url_path = pathlib.Path(self.environ["PATH_INFO"].strip("/"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        filename = pathlib.Path(os.path.normpath(str(url_path)))
 | 
					        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
 | 
					            # Guard against breaking out of the directory
 | 
				
			||||||
            self.send_status(STATUS_NOT_FOUND, "Not Found")
 | 
					            self.send_status(STATUS_NOT_FOUND, "Not Found")
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue