mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
Update security.py
This commit is contained in:
parent
3a277a282f
commit
1244a8677e
@ -185,8 +185,9 @@ def sanitize_path(path: str, allow_absolute_path: bool = False, allow_current_fo
|
||||
if path is None:
|
||||
return path
|
||||
|
||||
# Normalize path to use forward slashes
|
||||
path = path.replace('\\', '/')
|
||||
if not allow_absolute_path:
|
||||
# Normalize path to use forward slashes
|
||||
path = path.replace('\\', '/')
|
||||
path = path.strip()
|
||||
|
||||
if not allow_current_folder and path=="./":
|
||||
@ -382,4 +383,4 @@ class MultipartBoundaryCheck(BaseHTTPMiddleware):
|
||||
def is_valid_boundary(self, boundary):
|
||||
# RFC 2046 states that the boundary should only contain these characters
|
||||
valid_chars = set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'()+_,-./:=?")
|
||||
return all(char in valid_chars for char in boundary)
|
||||
return all(char in valid_chars for char in boundary)
|
||||
|
Loading…
Reference in New Issue
Block a user