From 42822ccdb8b1ea87a5b78e51275c5ed354921ddb Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Mon, 6 Nov 2023 14:54:07 +0100 Subject: [PATCH] Remove dead method Handle404 (#25315) --- server/channels/app/app.go | 13 ------------- server/channels/app/app_iface.go | 1 - .../channels/app/opentracing/opentracing_layer.go | 15 --------------- 3 files changed, 29 deletions(-) diff --git a/server/channels/app/app.go b/server/channels/app/app.go index dbb15fb077..aacc93bf35 100644 --- a/server/channels/app/app.go +++ b/server/channels/app/app.go @@ -13,7 +13,6 @@ import ( "github.com/mattermost/mattermost/server/public/shared/mlog" "github.com/mattermost/mattermost/server/public/shared/timezones" "github.com/mattermost/mattermost/server/v8/channels/product" - "github.com/mattermost/mattermost/server/v8/channels/utils" "github.com/mattermost/mattermost/server/v8/einterfaces" "github.com/mattermost/mattermost/server/v8/platform/services/httpservice" "github.com/mattermost/mattermost/server/v8/platform/services/imageproxy" @@ -46,18 +45,6 @@ func (s *Server) TemplatesContainer() *templates.Container { return s.htmlTemplateWatcher } -func (a *App) Handle404(w http.ResponseWriter, r *http.Request) { - ipAddress := utils.GetIPAddress(r, a.Config().ServiceSettings.TrustedProxyIPHeader) - mlog.Debug("not found handler triggered", mlog.String("path", r.URL.Path), mlog.Int("code", 404), mlog.String("ip", ipAddress)) - - if *a.Config().ServiceSettings.WebserverMode == "disabled" { - http.NotFound(w, r) - return - } - - utils.RenderWebAppError(a.Config(), w, r, model.NewAppError("Handle404", "api.context.404.app_error", nil, "", http.StatusNotFound), a.AsymmetricSigningKey()) -} - func (s *Server) getFirstServerRunTimestamp() (int64, *model.AppError) { systemData, err := s.Store().System().GetByName(model.SystemFirstServerRunTimestampKey) if err != nil { diff --git a/server/channels/app/app_iface.go b/server/channels/app/app_iface.go index 7530159e24..14594de4da 100644 --- a/server/channels/app/app_iface.go +++ b/server/channels/app/app_iface.go @@ -855,7 +855,6 @@ type AppIface interface { GetWarnMetricsBot() (*model.Bot, *model.AppError) GetWarnMetricsStatus(rctx request.CTX) (map[string]*model.WarnMetricStatus, *model.AppError) HTTPService() httpservice.HTTPService - Handle404(w http.ResponseWriter, r *http.Request) HandleCommandResponse(c request.CTX, command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError) HandleCommandResponsePost(c request.CTX, command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.Post, *model.AppError) HandleCommandWebhook(c request.CTX, hookID string, response *model.CommandResponse) *model.AppError diff --git a/server/channels/app/opentracing/opentracing_layer.go b/server/channels/app/opentracing/opentracing_layer.go index d8aa0d566c..615efc0243 100644 --- a/server/channels/app/opentracing/opentracing_layer.go +++ b/server/channels/app/opentracing/opentracing_layer.go @@ -11266,21 +11266,6 @@ func (a *OpenTracingAppLayer) GetWarnMetricsStatus(rctx request.CTX) (map[string return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) Handle404(w http.ResponseWriter, r *http.Request) { - origCtx := a.ctx - span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.Handle404") - - a.ctx = newCtx - a.app.Srv().Store().SetContext(newCtx) - defer func() { - a.app.Srv().Store().SetContext(origCtx) - a.ctx = origCtx - }() - - defer span.Finish() - a.app.Handle404(w, r) -} - func (a *OpenTracingAppLayer) HandleCommandResponse(c request.CTX, command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.HandleCommandResponse")