From 80bfe503356964ed8ced5f653c83626103a4c70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sun, 13 Oct 2024 22:48:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=91=E5=B8=83v2.3.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/bootstrap/conf.go | 2 +- internal/route/http.go | 2 +- internal/service/backup.go | 4 ++++ internal/service/file.go | 2 +- internal/service/file_windows.go | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) 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) {