Closed
Description
Version
4.14.1
Describe the bug
Activity.attachments is a list. Therefore, telemetry logger raises an exception (see below) if trying to call strip()
on attachements.
File "/Users/ivo/Projects/alvao-chatbot/bot/venv/lib/python3.8/site-packages/botbuilder/core/telemetry_logger_middleware.py", line 220, in fill_send_event_properties
if activity.attachments and activity.attachments.strip():
AttributeError: 'list' object has no attribute 'strip'
This line produces the bug: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-core/botbuilder/core/telemetry_logger_middleware.py#L220
To Reproduce
Steps to reproduce the behavior:
- Use TelemetryLoggerMiddleware
- Create a card message:
MessageFactory.attachment(Attachment(content_type="application/vnd.microsoft.card.adaptive", content=card))
- Send this activity from bot to user
- When this activity is being logged via TelemetryLoggerMiddleware, it raises an exception
Expected behavior
There should be another check than strip()
, possible len() > 0
. Function strip
returns a string without leading and trailing whitespaces. There is no sense to do that a) in a condition, b) on a list.