new changes
This commit is contained in:
@@ -21,7 +21,7 @@ def _resolve_path(path: str) -> str:
|
||||
if os.name != "nt":
|
||||
allowed.append(os.path.abspath("/www"))
|
||||
if ".." in path:
|
||||
raise HTTPException(status_code=401, detail="Path traversal not allowed")
|
||||
raise HTTPException(status_code=400, detail="Path traversal not allowed")
|
||||
norm_path = path.strip().replace("\\", "/").strip("/")
|
||||
# Root or www_root-style path
|
||||
if not norm_path or norm_path in ("www", "www/wwwroot", "wwwroot"):
|
||||
@@ -49,7 +49,7 @@ async def files_list(
|
||||
except HTTPException:
|
||||
raise
|
||||
if not os.path.isdir(full):
|
||||
raise HTTPException(status_code=401, detail="Not a directory")
|
||||
raise HTTPException(status_code=404, detail="Not a directory")
|
||||
items = []
|
||||
for name in os.listdir(full):
|
||||
item_path = os.path.join(full, name)
|
||||
|
||||
Reference in New Issue
Block a user