Skip to content

Commit

Permalink
🐛 fix mql printer for RawIP (#5307)
Browse files Browse the repository at this point in the history
Signed-off-by: Salim Afiune Maya <[email protected]>
  • Loading branch information
afiune authored Mar 11, 2025
1 parent 07024f9 commit e6601ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/printer/mql.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,9 @@ func (print *Printer) Data(typ types.Type, data interface{}, codeID string, bund
return print.Secondary(data.(string))

case types.IP:
if data == nil {
return print.Secondary("null")
}
return print.Secondary(data.(llx.RawIP).String())

case types.ArrayLike:
Expand Down
14 changes: 14 additions & 0 deletions cli/printer/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,20 @@ func TestPrinter(t *testing.T) {
"]",
},
},
{
"ip(\"\")",
"", // ignore
[]string{
"ip: null",
},
},
{
"ip(\"1.2.3.4\")",
"", // ignore
[]string{
"ip: 1.2.3.4",
},
},
})
}

Expand Down

0 comments on commit e6601ad

Please sign in to comment.