feat: Add API endpoint to list node files

Implement issue #2719 - Add API endpoint to list project files

- Add GET /v3/projects/{project_id}/nodes/{node_id}/files endpoint
- Add list_node_files() method to Project class
- Add security checks to prevent path traversal
- Filter out .ghost temporary files
- Return file paths with MD5 checksums
- Require Node.Audit privilege

This allows users to discover dynamically created files
such as QEMU disk images created via the disk image API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
YueGuobinandClaude Sonnet 4.6 committed 2026-05-08 22:52:17 +08:00
1 parent e0860555ba
commit 5b75d633aa
3 files changed
+69

No files matched your search

+14
View File
@@ -192,6 +192,20 @@ async def get_compute_project_files(project: Project = Depends(dep_project)) ->
return await project.list_files()
@router.get("/projects/{project_id}/nodes/{node_type}/{node_id}/files", response_model=List[schemas.ProjectFile])
async def get_compute_node_files(
node_type: str,
node_id: str,
project: Project = Depends(dep_project)
) -> List[schemas.ProjectFile]:
"""
Return files belonging to a specific node.
"""
node_path = f"project-files/{node_type}/{node_id}"
return await project.list_node_files(node_path)
@router.get("/projects/{project_id}/files/{file_path:path}")
async def get_compute_project_file(file_path: str, project: Project = Depends(dep_project)) -> FileResponse:
"""