Skip to content

Commit

Permalink
fix startswith types
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-p committed Nov 13, 2024
1 parent 1651a7f commit 8a36f0c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/algokit_subscriber/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,16 @@ def filter_transaction(t: TransactionResult) -> bool: # noqa: C901, PLR0912

if subscription.get("note_prefix"):
if isinstance(subscription["note_prefix"], bytes):
result = result and t.get("note", "").startswith(
subscription["note_prefix"]
note = t.get("note", b"")
result = (
result
and len(note) >= len(subscription["note_prefix"])
and note[: len(subscription["note_prefix"])]
== subscription["note_prefix"]
)
else:
result = result and t.get("note", "").startswith(
subscription["note_prefix"].encode()
subscription["note_prefix"]
)

if subscription.get("app_id"):
Expand Down

0 comments on commit 8a36f0c

Please sign in to comment.