From db66a1d3c5d5e44e3780c8a1cc3f349e31f680ce Mon Sep 17 00:00:00 2001 From: bmc-msft <41130664+bmc-msft@users.noreply.github.com> Date: Thu, 15 Jul 2021 19:57:41 -0400 Subject: [PATCH] check change event type before container name (#1075) --- src/api-service/__app__/queue_file_changes/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api-service/__app__/queue_file_changes/__init__.py b/src/api-service/__app__/queue_file_changes/__init__.py index e2b69b8757..42303a63ba 100644 --- a/src/api-service/__app__/queue_file_changes/__init__.py +++ b/src/api-service/__app__/queue_file_changes/__init__.py @@ -29,10 +29,11 @@ def file_added(event: Dict, fail_task_on_transient_error: bool) -> None: def main(msg: func.QueueMessage, dashboard: func.Out[str]) -> None: event = json.loads(msg.get_body()) last_try = msg.dequeue_count == MAX_DEQUEUE_COUNT - if event["topic"] not in corpus_accounts(): + # check type first before calling Azure APIs + if event["eventType"] != "Microsoft.Storage.BlobCreated": return - if event["eventType"] != "Microsoft.Storage.BlobCreated": + if event["topic"] not in corpus_accounts(): return file_added(event, last_try)