commit 8e16299: [Minor] Fix HTTP status code

moisseev moiseev at mezonplus.ru
Wed Jun 3 18:56:12 UTC 2020


Author: moisseev
Date: 2020-06-03 19:41:52 +0300
URL: https://github.com/rspamd/rspamd/commit/8e162998ac110a4ae294427c6ede73ebfd64d960 (refs/pull/3389/head)

[Minor] Fix HTTP status code
We should treat invalid selector as a negative result of the check.

---
 rules/controller/selectors.lua | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/rules/controller/selectors.lua b/rules/controller/selectors.lua
index 58065fc85..905757c76 100644
--- a/rules/controller/selectors.lua
+++ b/rules/controller/selectors.lua
@@ -30,11 +30,7 @@ local function handle_check_selector(_, conn, req_params)
   if req_params.selector then
     local selector = lua_selectors.create_selector_closure(rspamd_config,
         req_params.selector, '', true)
-    if not selector then
-      conn:send_error(500, 'invalid selector')
-    else
-      conn:send_ucl({success = true})
-    end
+      conn:send_ucl({success = selector and true})
   else
     conn:send_error(404, 'missing selector')
   end
@@ -74,4 +70,4 @@ return {
     enable = true,
     need_task = true,
   }
-}
\ No newline at end of file
+}


More information about the Commits mailing list