diff --git a/godo/cmd/serve.go b/godo/cmd/serve.go index 849c7e2..993627d 100644 --- a/godo/cmd/serve.go +++ b/godo/cmd/serve.go @@ -86,7 +86,7 @@ func (l loggingMiddleware) Middleware(next http.Handler) http.Handler { // CORS 中间件 func corsMiddleware() mux.MiddlewareFunc { - allowHeaders := "Content-Type, Accept, Authorization, Origin,pwd,salt" + allowHeaders := "Content-Type, Accept, Authorization, Origin,Pwd,Salt" allowMethods := "GET, POST, PUT, DELETE, OPTIONS" return func(next http.Handler) http.Handler { diff --git a/godo/files/fs.go b/godo/files/fs.go index 29c8dd6..ec9fd03 100644 --- a/godo/files/fs.go +++ b/godo/files/fs.go @@ -182,6 +182,12 @@ func HandleUnlink(w http.ResponseWriter, r *http.Request) { libs.HTTPError(w, http.StatusConflict, err.Error()) return } + // 如果有同名隐藏文件,也要删除掉 + hiddenFilePath := filepath.Join(basePath, filepath.Dir(path), "."+filepath.Base(path)) + _, err = os.Stat(hiddenFilePath) + if err == nil { + os.Remove(hiddenFilePath) + } res := libs.APIResponse{Message: fmt.Sprintf("File '%s' successfully removed.", path)} json.NewEncoder(w).Encode(res) }