fix(file-manager): fix create-folder API to accept JSON request body
The create_folder endpoint was incorrectly defined to accept query parameters instead of JSON request body, causing 400 errors when called from the frontend. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
306cebd8f1
commit
fbbf0c0653
@ -260,15 +260,20 @@ async def delete_item(path: str):
|
||||
|
||||
|
||||
@router.post("/create-folder")
|
||||
async def create_folder(path: str, name: str):
|
||||
async def create_folder(request: Dict[str, str]):
|
||||
"""
|
||||
创建文件夹
|
||||
|
||||
Args:
|
||||
path: 父目录路径
|
||||
name: 新文件夹名称
|
||||
request: 包含path和name字段的JSON对象
|
||||
"""
|
||||
try:
|
||||
path = request.get("path", "")
|
||||
name = request.get("name", "")
|
||||
|
||||
if not name:
|
||||
raise HTTPException(status_code=400, detail="文件夹名称不能为空")
|
||||
|
||||
parent_path = resolve_path(path) if path else resolve_path("projects")
|
||||
parent_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user