From d6a9f0b8527b73fa5d6382ffce64b3678867df21 Mon Sep 17 00:00:00 2001 From: revolyssup Date: Thu, 3 Aug 2023 12:01:56 +0530 Subject: [PATCH 1/3] fix: add skipped nil check for "applications" upvalue Signed-off-by: revolyssup --- apisix/discovery/nacos/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisix/discovery/nacos/init.lua b/apisix/discovery/nacos/init.lua index e12c025c56d5..edc8c6c46457 100644 --- a/apisix/discovery/nacos/init.lua +++ b/apisix/discovery/nacos/init.lua @@ -361,7 +361,7 @@ function _M.nodes(service_name, discovery_args) waiting_time = waiting_time - step end - if not applications[namespace_id] or not applications[namespace_id][group_name] then + if not applications or not applications[namespace_id] or not applications[namespace_id][group_name] then return nil end return applications[namespace_id][group_name][service_name] From ff0d34f9ac3bde8b684122535dfacbe95c892afd Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Thu, 3 Aug 2023 14:16:28 +0530 Subject: [PATCH 2/3] fix lint Signed-off-by: Ashish Tiwari --- apisix/discovery/nacos/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apisix/discovery/nacos/init.lua b/apisix/discovery/nacos/init.lua index edc8c6c46457..61dd54b8dc9b 100644 --- a/apisix/discovery/nacos/init.lua +++ b/apisix/discovery/nacos/init.lua @@ -361,8 +361,9 @@ function _M.nodes(service_name, discovery_args) waiting_time = waiting_time - step end - if not applications or not applications[namespace_id] or not applications[namespace_id][group_name] then - return nil + if not applications or not applications[namespace_id] + or not applications[namespace_id][group_name] then + return nil end return applications[namespace_id][group_name][service_name] end From a3d60116e1c7eda7e7e52f06b8d8da0c6923a2c4 Mon Sep 17 00:00:00 2001 From: Ashish Tiwari Date: Thu, 3 Aug 2023 14:33:21 +0530 Subject: [PATCH 3/3] add four space Signed-off-by: Ashish Tiwari --- apisix/discovery/nacos/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apisix/discovery/nacos/init.lua b/apisix/discovery/nacos/init.lua index 61dd54b8dc9b..2e06f5553493 100644 --- a/apisix/discovery/nacos/init.lua +++ b/apisix/discovery/nacos/init.lua @@ -362,8 +362,9 @@ function _M.nodes(service_name, discovery_args) end if not applications or not applications[namespace_id] - or not applications[namespace_id][group_name] then - return nil + or not applications[namespace_id][group_name] + then + return nil end return applications[namespace_id][group_name][service_name] end