diff --git a/ai-hub/app/api/routes/nodes.py b/ai-hub/app/api/routes/nodes.py index 6d7ba8c..c1c561c 100644 --- a/ai-hub/app/api/routes/nodes.py +++ b/ai-hub/app/api/routes/nodes.py @@ -750,13 +750,13 @@ raise HTTPException(status_code=500, detail=str(e)) @router.delete("/{node_id}/fs/rm", summary="Delete File/Directory") - def fs_rm(node_id: str, req: schemas.FileDeleteRequest, session_id: str = "__fs_explorer__"): + def fs_rm(node_id: str, path: str, session_id: str = "__fs_explorer__"): """ Delete a file or directory from a remote node. """ try: orchestrator = services.orchestrator - res = orchestrator.assistant.rm(node_id, req.path, session_id=session_id) + res = orchestrator.assistant.rm(node_id, path, session_id=session_id) if not res: raise HTTPException(status_code=500, detail="Node returned an empty response.") if isinstance(res, dict) and "error" in res: diff --git a/ui/client-app/src/components/FileSystemNavigator.js b/ui/client-app/src/components/FileSystemNavigator.js index 9097692..86aae85 100644 --- a/ui/client-app/src/components/FileSystemNavigator.js +++ b/ui/client-app/src/components/FileSystemNavigator.js @@ -138,7 +138,18 @@ } }; + const isBinaryFile = (path) => { + const ext = path.split('.').pop().toLowerCase(); + const binaryExts = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'ico', 'pdf', 'zip', 'gz', 'tar', 'exe', 'dll', 'so', 'bin', 'pyc', 'node', 'db', 'sqlite']; + return binaryExts.includes(ext); + }; + const handleView = async (path) => { + if (isBinaryFile(path)) { + setError(`Cannot view binary file: ${path}. Please download it instead.`); + return; + } + setOperationLoading(true); setError(null); try { @@ -334,7 +345,7 @@ {/* Editor Modal */} {selectedFile && (
-
+

{selectedFile.path}