From d89dac6159af3be02ceef31aec17755f5031101d Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 5 Aug 2018 21:01:55 +0200 Subject: [PATCH] Check exclude regex on HTML as well --- cmd/eksterd/memory.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cmd/eksterd/memory.go b/cmd/eksterd/memory.go index 99a9f34..dc0a4f0 100644 --- a/cmd/eksterd/memory.go +++ b/cmd/eksterd/memory.go @@ -641,6 +641,10 @@ func (b *memoryBackend) Fetch3(channel, fetchURL string) (*http.Response, error) } func (b *memoryBackend) channelAddItemWithMatcher(conn redis.Conn, channel string, item microsub.Item) error { + // an item is posted + // check for all channels as channel + // if regex matches item + // - add item to channel for channelKey, setting := range b.Settings { if setting.IncludeRegex != "" { included := false @@ -671,9 +675,15 @@ func (b *memoryBackend) channelAddItemWithMatcher(conn redis.Conn, channel strin if err != nil { log.Printf("error in regexp: %q\n", excludeRegex) } else { - if item.Content != nil && excludeRegex.MatchString(item.Content.Text) { - log.Printf("Excluded %#v\n", item) - return nil + if item.Content != nil { + if excludeRegex.MatchString(item.Content.Text) { + log.Printf("Excluded %#v\n", item) + return nil + } + if excludeRegex.MatchString(item.Content.HTML) { + log.Printf("Excluded %#v\n", item) + return nil + } } if excludeRegex.MatchString(item.Name) {