diff --git a/server/memo.go b/server/memo.go index 526a747af..fc7d1951c 100644 --- a/server/memo.go +++ b/server/memo.go @@ -176,8 +176,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) { return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete memo ID: %v", memoID)).SetInternal(err) } - c.JSON(http.StatusOK, true) - return nil + return c.JSON(http.StatusOK, true) }) g.GET("/memo/amount", func(c echo.Context) error { diff --git a/server/resource.go b/server/resource.go index 700329c30..9a1140d02 100644 --- a/server/resource.go +++ b/server/resource.go @@ -118,7 +118,10 @@ func (s *Server) registerResourceRoutes(g *echo.Group) { c.Response().Writer.WriteHeader(http.StatusOK) c.Response().Writer.Header().Set("Content-Type", resource.Type) - c.Response().Writer.Write(resource.Blob) + if _, err := c.Response().Writer.Write(resource.Blob); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, "Failed to write resource blob").SetInternal(err) + } + return nil }) @@ -135,7 +138,6 @@ func (s *Server) registerResourceRoutes(g *echo.Group) { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to delete resource").SetInternal(err) } - c.JSON(http.StatusOK, true) - return nil + return c.JSON(http.StatusOK, true) }) } diff --git a/server/shortcut.go b/server/shortcut.go index bfdf5356f..b2e555f99 100644 --- a/server/shortcut.go +++ b/server/shortcut.go @@ -109,7 +109,6 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to delete shortcut").SetInternal(err) } - c.JSON(http.StatusOK, true) - return nil + return c.JSON(http.StatusOK, true) }) } diff --git a/server/webhook.go b/server/webhook.go index 4b9085854..c03ece530 100644 --- a/server/webhook.go +++ b/server/webhook.go @@ -261,7 +261,10 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) { c.Response().Writer.WriteHeader(http.StatusOK) c.Response().Writer.Header().Set("Content-Type", resource.Type) - c.Response().Writer.Write(resource.Blob) + if _, err := c.Response().Writer.Write(resource.Blob); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, "Failed to write response").SetInternal(err) + } + return nil }) } diff --git a/store/db/db.go b/store/db/db.go index 2d12f0175..b2ca66e4e 100644 --- a/store/db/db.go +++ b/store/db/db.go @@ -201,7 +201,7 @@ var minorDirRegexp = regexp.MustCompile(`^migration/[0-9]+\.[0-9]+$`) func getMinorVersionList() []string { minorVersionList := []string{} - fs.WalkDir(migrationFS, "migration", func(path string, file fs.DirEntry, err error) error { + if err := fs.WalkDir(migrationFS, "migration", func(path string, file fs.DirEntry, err error) error { if err != nil { return err } @@ -210,7 +210,9 @@ func getMinorVersionList() []string { } return nil - }) + }); err != nil { + panic(err) + } sort.Strings(minorVersionList)