Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aos): matchesspec does not work with from-process #337 #383

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions process/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,25 @@ function utils.matchesSpec(msg, spec)
end
if type(spec) == 'table' then
for key, pattern in pairs(spec) do
if not msg[key] then
-- The key can either be in the top level of the 'msg' object or within the 'Tags'

local msgValue = msg[key]
local msgTagValue = msg['Tags'] and msg['Tags'][key]

if not msgValue and not msgTagValue then
return false
end
if not utils.matchesPattern(pattern, msg[key], msg) then

local matchesMsgValue = utils.matchesPattern(pattern, msgValue, msg)
local matchesMsgTagValue = utils.matchesPattern(pattern, msgTagValue, msg)

if not matchesMsgValue and not matchesMsgTagValue then
return false
end
end
return true
end

if type(spec) == 'string' and msg.Action and msg.Action == spec then
return true
end
Expand Down
Loading