Skip to content

Commit

Permalink
Cast API event filters and field values to str
Browse files Browse the repository at this point in the history
  • Loading branch information
aussig committed Feb 2, 2024
1 parent b0c88dc commit 71558ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## v3.4.0-xx - xxxx-xx-xx

### Bug Fixes:

* If an `/events` API client sets an event filter using an integer as the filter, e.g. `3`, this was throwing an error and the event would not have been sent.


## v3.4.0-a2 - 2024-02-02
Expand Down
5 changes: 3 additions & 2 deletions bgstally/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@ def _is_filtered(self, event:dict) -> bool:
if filters is None: return False

for field, filter in filters.items():
Debug.logger.info(f"Checking for match against {filter} in field {field} in event. Field value: {event.get(field, '')}. Match: {match(filter, event.get(field, ''))}")
if not match(filter, event.get(field, "")): return True
filter_str:str = str(filter)
value_str:str = str(event.get(field, ""))
if not match(filter_str, value_str): return True

# All fields matched, don't filter out this event
return False
Expand Down

0 comments on commit 71558ef

Please sign in to comment.