From 2ad52d8c958039257daed5abfa70b226576d0b3f Mon Sep 17 00:00:00 2001 From: Christian Roessner Date: Tue, 3 Dec 2024 17:05:47 +0100 Subject: [PATCH] Fix: Add early return in feature error handling Introduce early return statements in error handling blocks within FeatureLua and FeatureRBLs functions. This prevents further execution when errors are encountered, ensuring more reliable performance and preventing potential side effects. Signed-off-by: Christian Roessner --- server/core/features.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/core/features.go b/server/core/features.go index 5a45f74d..9224fc5c 100644 --- a/server/core/features.go +++ b/server/core/features.go @@ -439,6 +439,8 @@ func (a *AuthState) checkLuaFeature(ctx *gin.Context) (triggered bool, abortFeat triggered, abortFeatures, err = a.FeatureLua(ctx) if err != nil { a.FeatureName = "" + + return } if triggered { @@ -501,6 +503,8 @@ func (a *AuthState) checkRBLFeature(ctx *gin.Context) (triggered bool, err error triggered, err = a.FeatureRBLs(ctx) if err != nil || !triggered { a.FeatureName = "" + + return } a.processFeatureAction(definitions.FeatureRBL, definitions.LuaActionRBL, definitions.LuaActionRBLName)