Skip to content

Commit

Permalink
fix(aos): matchesspec does not work with from-process #337
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremiahstockdale committed Oct 21, 2024
1 parent c883591 commit 9b83ea7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions process/utils.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = { _version = "0.0.5" }
utils = { _version = "0.0.5" }

function utils.matchesPattern(pattern, value, msg)
-- If the key is not in the message, then it does not match
Expand Down Expand Up @@ -57,10 +57,12 @@ function utils.matchesSpec(msg, spec)
end
if type(spec) == 'table' then
for key, pattern in pairs(spec) do
if not msg[key] then
local msgTagsKey = msg['Tags'] and msg['Tags'][key]

if not msg[key] and not msgTagsKey then
return false
end
if not utils.matchesPattern(pattern, msg[key], msg) then
if not utils.matchesPattern(pattern, msg[key], msg) and not utils.matchesPattern(pattern, msg['Tags'][key], msg) then
return false
end
end
Expand Down

0 comments on commit 9b83ea7

Please sign in to comment.