Merge pull request #416 from tidwall/Fixing-webhook-processing-bug

Verify hook names match for processing
This commit is contained in:
Josh Baker 2019-02-23 08:59:16 -07:00 committed by GitHub
commit 3d3e041d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import (
"time"
"github.com/tidwall/buntdb"
"github.com/tidwall/gjson"
"github.com/tidwall/resp"
"github.com/tidwall/tile38/internal/endpoint"
"github.com/tidwall/tile38/internal/glob"
@ -597,8 +598,11 @@ func (h *Hook) proc() (ok bool) {
err := tx.AscendGreaterOrEqual("hooks",
h.query, func(key, val string) bool {
if strings.HasPrefix(key, hookLogPrefix) {
keys = append(keys, key)
vals = append(vals, val)
// Verify this hooks name matches the one in the notif
if h.Name == gjson.Get(val, "hook").String() {
keys = append(keys, key)
vals = append(vals, val)
}
}
return true
},