fix #143 broken hook data

This commit is contained in:
mike kabischev 2017-02-08 14:16:54 +03:00
parent 6f5bb459e1
commit 237d4b2284
1 changed files with 9 additions and 6 deletions

View File

@ -193,12 +193,15 @@ func fenceMatch(hookName string, sw *scanWriter, fence *liveFenceSwitches, metas
} }
msgs := make([][]byte, 0, 4) msgs := make([][]byte, 0, 4)
if fence.detect == nil || fence.detect[detect] {
if fence.detect == nil || fence.detect[detect] { if fence.detect == nil || fence.detect[detect] {
if len(res) > 0 && res[0] == '{' { if len(res) > 0 && res[0] == '{' {
res = makemsg(details.command, group, detect, hookName, metas, details.key, details.timestamp, res[1:]) msgs = append(msgs, makemsg(details.command, group, detect, hookName, metas, details.key, details.timestamp, res[1:]))
} } else {
msgs = append(msgs, res) msgs = append(msgs, res)
} }
}
}
switch detect { switch detect {
case "enter": case "enter":
if fence.detect == nil || fence.detect["inside"] { if fence.detect == nil || fence.detect["inside"] {