fix: 网元文件获取改用find读取避免Argument list too long错误

This commit is contained in:
TsMask
2024-10-08 16:33:43 +08:00
parent d0f946cc85
commit 4267c7df9d
3 changed files with 27 additions and 25 deletions

View File

@@ -181,13 +181,12 @@ func (s *NeActionController) Files(c *gin.Context) {
defer sshClient.Close()
// 获取文件列表
totalSize, rows, err := ssh.FileList(sshClient, querys.Path, querys.Search)
rows, err := ssh.FileList(sshClient, querys.Path, querys.Search)
if err != nil {
c.JSON(200, result.Ok(map[string]any{
"path": querys.Path,
"totalSize": totalSize,
"total": len(rows),
"rows": []ssh.FileListRow{},
"path": querys.Path,
"total": len(rows),
"rows": []ssh.FileListRow{},
}))
return
}
@@ -206,10 +205,9 @@ func (s *NeActionController) Files(c *gin.Context) {
}
c.JSON(200, result.Ok(map[string]any{
"path": querys.Path,
"totalSize": totalSize,
"total": lenNum,
"rows": splitRows,
"path": querys.Path,
"total": lenNum,
"rows": splitRows,
}))
}

View File

@@ -188,7 +188,7 @@ func (r *TraceTaskHlr) File(traceId, dirPath string) ([]map[string]any, error) {
// 获取文件列表
fileName := fmt.Sprintf("%s_%s", neInfo.NeName, traceId)
_, rows, err := ssh.FileList(sshClient, filepath.ToSlash(dirPath), fileName)
rows, err := ssh.FileList(sshClient, filepath.ToSlash(dirPath), fileName)
if err != nil {
hlrItem["err"] = "file not found"
hlrList = append(hlrList, hlrItem)