From 523f6412a7413fcc2c0564d5edbcabdcea040d7f Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 16 Sep 2025 18:35:59 +0800 Subject: [PATCH] Fix API parameters for createSSHFile and createSSHFolder - Correct createSSHFile to use separate path, fileName, and content parameters - Correct createSSHFolder to use separate path and folderName parameters - Add missing hostId and userId parameters for proper API calls - Fix 'File/Folder path and name are required' 400 errors - Ensure API calls match backend expectations: - createSSHFile(sessionId, path, fileName, content, hostId, userId) - createSSHFolder(sessionId, path, folderName, hostId, userId) - Maintain full path construction for frontend file tracking --- .../Apps/File Manager/FileManagerModern.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx b/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx index 33e5f0ec..3d4f75df 100644 --- a/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx +++ b/src/ui/Desktop/Apps/File Manager/FileManagerModern.tsx @@ -326,7 +326,14 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) { // 确保SSH连接有效 await ensureSSHConnection(); - await createSSHFolder(sshSessionId, folderPath); + // API需要分离的path和folderName参数 + await createSSHFolder( + sshSessionId, + currentPath, + defaultName, + currentHost?.id, + currentHost?.userId?.toString() + ); // 重新加载目录 await loadDirectory(currentPath); @@ -361,7 +368,15 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) { // 确保SSH连接有效 await ensureSSHConnection(); - await createSSHFile(sshSessionId, filePath, ""); + // API需要分离的path、fileName和content参数 + await createSSHFile( + sshSessionId, + currentPath, + defaultName, + "", + currentHost?.id, + currentHost?.userId?.toString() + ); // 重新加载目录 await loadDirectory(currentPath);