Browse Source

fix:修改文件路径字段

master
刘子旺 7 months ago
parent
commit
662d1c57af
  1. 2
      godo/files/fs.go
  2. 5
      godo/files/pwdfile.go

2
godo/files/fs.go

@ -317,7 +317,7 @@ func HandleCopyFile(w http.ResponseWriter, r *http.Request) {
// 带加密写
func HandleWriteFile(w http.ResponseWriter, r *http.Request) {
filePath := r.URL.Query().Get("filePath")
filePath := r.URL.Query().Get("path")
basePath, err := libs.GetOsDir()
if err != nil {
libs.HTTPError(w, http.StatusInternalServerError, err.Error())

5
godo/files/pwdfile.go

@ -20,6 +20,7 @@ func HandleReadFile(w http.ResponseWriter, r *http.Request) {
}
// 非加密文件直接返回base64编码
isHide := IsHaveHiddenFile(basePath, path)
//Liuziwang888!@#
if !isHide {
fileContent, err := ReadFile(basePath, path)
if err != nil {
@ -35,7 +36,7 @@ func HandleReadFile(w http.ResponseWriter, r *http.Request) {
return
}
// 有隐藏文件说明这是一个加密过的文件,需要验证密码
fPwd := r.Header.Get("filePwd")
fPwd := r.Header.Get("pwd")
if fPwd == "" {
libs.HTTPError(w, http.StatusBadRequest, "密码不能为空")
return
@ -71,7 +72,7 @@ func HandleReadFile(w http.ResponseWriter, r *http.Request) {
// 设置文件密码
func HandleSetFilePwd(w http.ResponseWriter, r *http.Request) {
fPwd := r.Header.Get("filePwd")
fPwd := r.Header.Get("filepwd")
salt, err := GetSalt(r) // 获取盐值
// 处理获取盐值时的错误
if err != nil || fPwd == "" {

Loading…
Cancel
Save