|
2 | 2 | # Licensed under the MIT License.
|
3 | 3 | """Middleware Component for logging Activity messages."""
|
4 | 4 | from typing import Awaitable, Callable, List, Dict
|
| 5 | +from jsonpickle import encode |
| 6 | + |
5 | 7 | from botbuilder.schema import Activity, ConversationReference, ActivityTypes
|
6 | 8 | from botbuilder.schema.teams import TeamsChannelData, TeamInfo
|
7 | 9 | from botframework.connector import Channels
|
@@ -33,7 +35,7 @@ def telemetry_client(self) -> BotTelemetryClient:
|
33 | 35 |
|
34 | 36 | @property
|
35 | 37 | def log_personal_information(self) -> bool:
|
36 |
| - """ Gets a value indicating whether determines whether to log personal |
| 38 | + """Gets a value indicating whether determines whether to log personal |
37 | 39 | information that came from the user."""
|
38 | 40 | return self._log_personal_information
|
39 | 41 |
|
@@ -217,10 +219,10 @@ async def fill_send_event_properties(
|
217 | 219 |
|
218 | 220 | # Use the LogPersonalInformation flag to toggle logging PII data, text and user name are common examples
|
219 | 221 | if self.log_personal_information:
|
220 |
| - if activity.attachments and activity.attachments.strip(): |
221 |
| - properties[ |
222 |
| - TelemetryConstants.ATTACHMENTS_PROPERTY |
223 |
| - ] = activity.attachments |
| 222 | + if activity.attachments and len(activity.attachments) > 0: |
| 223 | + properties[TelemetryConstants.ATTACHMENTS_PROPERTY] = encode( |
| 224 | + activity.attachments |
| 225 | + ) |
224 | 226 | if activity.from_property.name and activity.from_property.name.strip():
|
225 | 227 | properties[
|
226 | 228 | TelemetryConstants.FROM_NAME_PROPERTY
|
|
0 commit comments