diff --git a/internal/bootstrap/conf.go b/internal/bootstrap/conf.go index 0dfbe80754..7274bd8927 100644 --- a/internal/bootstrap/conf.go +++ b/internal/bootstrap/conf.go @@ -26,7 +26,7 @@ func initConf() { func initGlobal() { app.Root = app.Conf.MustString("app.root") - app.Version = "2.3.2" + app.Version = "2.3.3" app.Locale = app.Conf.MustString("app.locale") // 初始化时区 diff --git a/internal/route/http.go b/internal/route/http.go index bf5c37e7e3..0b6bdfa504 100644 --- a/internal/route/http.go +++ b/internal/route/http.go @@ -217,7 +217,7 @@ func Http(r chi.Router) { r.Get("/content", file.Content) r.Post("/save", file.Save) r.Post("/delete", file.Delete) - r.Post("/upload", file.Upload) // TODO fix + r.Post("/upload", file.Upload) r.Post("/move", file.Move) r.Post("/copy", file.Copy) r.Get("/download", file.Download) diff --git a/internal/service/backup.go b/internal/service/backup.go index 1492577a77..fd5b5d466e 100644 --- a/internal/service/backup.go +++ b/internal/service/backup.go @@ -62,6 +62,10 @@ func (s *BackupService) Upload(w http.ResponseWriter, r *http.Request) { } _, handler, err := r.FormFile("file") + if err != nil { + Error(w, http.StatusInternalServerError, "上传文件失败:%v", err) + return + } path, err := s.backupRepo.GetPath(biz.BackupType(r.FormValue("type"))) if err != nil { Error(w, http.StatusInternalServerError, "%v", err) diff --git a/internal/service/file.go b/internal/service/file.go index 0057225803..8b42d61c24 100644 --- a/internal/service/file.go +++ b/internal/service/file.go @@ -128,7 +128,7 @@ func (s *FileService) Upload(w http.ResponseWriter, r *http.Request) { path := r.FormValue("path") _, handler, err := r.FormFile("file") if err != nil { - Error(w, http.StatusInternalServerError, "%v", err) + Error(w, http.StatusInternalServerError, "上传文件失败:%v", err) return } if io.Exists(path) { diff --git a/internal/service/file_windows.go b/internal/service/file_windows.go index 97b5c794fb..64485cf379 100644 --- a/internal/service/file_windows.go +++ b/internal/service/file_windows.go @@ -128,7 +128,7 @@ func (s *FileService) Upload(w http.ResponseWriter, r *http.Request) { path := r.FormValue("path") _, handler, err := r.FormFile("file") if err != nil { - Error(w, http.StatusInternalServerError, "%v", err) + Error(w, http.StatusInternalServerError, "上传文件失败:%v", err) return } if io.Exists(path) {