Skip to content

Commit

Permalink
Merge pull request #383 from permaweb/jeremiahstockdale-aos-337
Browse files Browse the repository at this point in the history
fix(aos): matchesspec does not work with from-process #337
  • Loading branch information
twilson63 authored Nov 14, 2024
2 parents 62cb9f0 + ca44e70 commit 945b2f3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions process/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,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

0 comments on commit 945b2f3

Please sign in to comment.