Browse Source

fix:修改写文件的bug

master
刘子旺 7 months ago
parent
commit
62a5552e19
  1. 9
      godo/files/fs.go

9
godo/files/fs.go

@ -327,7 +327,9 @@ func HandleCopyFile(w http.ResponseWriter, r *http.Request) {
} }
// 如果是一个复制的加密文件,则隐藏的文件也要复制过去 // 如果是一个复制的加密文件,则隐藏的文件也要复制过去
if IsHaveHiddenFile(basePath, srcPath) { if IsHaveHiddenFile(basePath, srcPath) {
if err := CopyFile(filepath.Join(basePath, srcPath), filepath.Join(basePath, dstPath)); err != nil { hiddenSrcPath := filepath.Join(basePath, filepath.Dir(srcPath), "."+filepath.Base(srcPath))
hiddenDstPath := filepath.Join(basePath, filepath.Dir(dstPath), "."+filepath.Base(dstPath))
if err := CopyFile(hiddenSrcPath, hiddenDstPath); err != nil {
libs.HTTPError(w, http.StatusInternalServerError, err.Error()) libs.HTTPError(w, http.StatusInternalServerError, err.Error())
return return
} }
@ -382,9 +384,8 @@ func HandleWriteFile(w http.ResponseWriter, r *http.Request) {
// 没有加密写入明文 // 没有加密写入明文
if !ispwd { if !ispwd {
_, err := io.Copy(file, fileContent) if _, err := file.Write(filedata); err != nil {
if err != nil { libs.HTTPError(w, http.StatusInternalServerError, err.Error())
http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
CheckAddDesktop(filePath) CheckAddDesktop(filePath)

Loading…
Cancel
Save