From f865fde476cc6c09bcd7cea0423124314de59aee Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Tue, 10 Oct 2023 15:06:20 +0200 Subject: [PATCH] If no route is selected, metal-api crashes with a npe --- auditing/auditing-interceptor.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/auditing/auditing-interceptor.go b/auditing/auditing-interceptor.go index db70f79..a7fb58f 100644 --- a/auditing/auditing-interceptor.go +++ b/auditing/auditing-interceptor.go @@ -300,6 +300,11 @@ func HttpFilter(a Auditing, logger *zap.SugaredLogger) restful.FilterFunction { case http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete: break default: + if request.SelectedRoute() == nil { + logger.Debugw("selected route is not defined, continue request processing") + chain.ProcessFilter(request, response) + return + } included, ok := request.SelectedRoute().Metadata()[Include].(bool) if ok && included { break