@@ -178,29 +178,36 @@ func (r *Rule) FromVar(id int64, dataTypes []string, ruleName any, confidentiali
178178
179179 if references != nil {
180180 referencesStr := utils .CastString (references )
181- err := json .Unmarshal ([]byte (referencesStr ), & referencesList )
182- if err != nil {
183- return catcher .Error ("failed to unmarshal references list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
181+ if referencesStr != "" {
182+ err := json .Unmarshal ([]byte (referencesStr ), & referencesList )
183+ if err != nil {
184+ return catcher .Error ("failed to unmarshal references list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
185+ }
184186 }
185187 }
186188
187189 var deduplicateByList []string
188190
189191 if deduplicateBy != nil {
190192 deduplicateStr := utils .CastString (deduplicateBy )
191- err := json .Unmarshal ([]byte (deduplicateStr ), & deduplicateByList )
192- if err != nil {
193- return catcher .Error ("failed to unmarshal deduplicate list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
193+ if deduplicateStr != "" {
194+ err := json .Unmarshal ([]byte (deduplicateStr ), & deduplicateByList )
195+ if err != nil {
196+ return catcher .Error ("failed to unmarshal deduplicateBy list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
197+ }
194198 }
199+
195200 }
196201
197202 var groupByList []string
198203
199204 if groupBy != nil {
200205 groupByStr := utils .CastString (groupBy )
201- err := json .Unmarshal ([]byte (groupByStr ), & groupByList )
202- if err != nil {
203- return catcher .Error ("failed to unmarshal groupBy list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
206+ if groupByStr != "" {
207+ err := json .Unmarshal ([]byte (groupByStr ), & groupByList )
208+ if err != nil {
209+ return catcher .Error ("failed to unmarshal groupBy list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
210+ }
204211 }
205212 }
206213
@@ -209,14 +216,16 @@ func (r *Rule) FromVar(id int64, dataTypes []string, ruleName any, confidentiali
209216 if after != nil {
210217 var afterBackendObj []SearchRequestBackend
211218 afterStr := utils .CastString (after )
212- err := json .Unmarshal ([]byte (afterStr ), & afterBackendObj )
213- if err != nil {
214- return catcher .Error ("failed to unmarshal after list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
215- }
219+ if afterStr != "" {
220+ err := json .Unmarshal ([]byte (afterStr ), & afterBackendObj )
221+ if err != nil {
222+ return catcher .Error ("failed to unmarshal correlation list" , err , map [string ]any {"process" : "plugin_com.utmstack.config" })
223+ }
216224
217- // Convert each SearchRequestBackend to SearchRequest
218- for _ , req := range afterBackendObj {
219- afterObj = append (afterObj , req .ToSearchRequest ())
225+ // Convert each SearchRequestBackend to SearchRequest
226+ for _ , req := range afterBackendObj {
227+ afterObj = append (afterObj , req .ToSearchRequest ())
228+ }
220229 }
221230 }
222231
0 commit comments