8000 An activity with attachments raises an exception in telemetry logger · Issue #1880 · microsoft/botbuilder-python · GitHub
[go: up one dir, main page]

Skip to content
An activity with attachments raises an exception in telemetry logger #1880
Closed
@ivopisarovic

Description

@ivopisarovic

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:

  1. Use TelemetryLoggerMiddleware
  2. Create a card message: MessageFactory.attachment(Attachment(content_type="application/vnd.microsoft.card.adaptive", content=card))
  3. Send this activity from bot to user
  4. 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.

Metadata

Metadata

Assignees

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.bugIndicates an unexpected problem or an unintended behavior.customer-reportedIssue is created by anyone that is not a collaborator in the repository.needs-triageThe issue has just been created and it has not been reviewed by the team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0