From d31d88fb896473f9ff1bf266628a2bee7dc5cf43 Mon Sep 17 00:00:00 2001 From: xc Date: Fri, 10 Oct 2025 14:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=85=A5=E7=9B=AE=E6=A0=87=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=98=E6=94=BE=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scagent/core/UpFile.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scagent/core/UpFile.go b/scagent/core/UpFile.go index 20ddbca..7d708c5 100644 --- a/scagent/core/UpFile.go +++ b/scagent/core/UpFile.go @@ -21,6 +21,7 @@ type FileInfo struct { type FileChunk struct { Data []byte FileName string + DirPath string Offset int64 IsLast bool } @@ -61,14 +62,14 @@ func (f *UpFileService) SendFileChunk(chunk FileChunk, reply *bool) error { // 日志 logger := util.NewProductionLogger() defer logger.Sync() - filePath := filepath.Join("received_files", chunk.FileName) + // filePath := filepath.Join("/www/afs/logs/00", chunk.FileName) // fmt.Printf("recive file :%s", chunk.FileName) // 合并为实际路径 - // filePath := filepath.Join(dirPath, chunk.FileName) + filePath := filepath.Join(chunk.DirPath, chunk.FileName) // filePath := chunk.FileName // 打开文件,使用追加模式 - file, err := os.OpenFile(filePath, os.O_RDWR, 0644) + file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, 0644) if err != nil { logger.Error("SendFileChunk OpenFile failed", zap.Error(err)) }