microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
878 stars 484 forks source link

Attachments with special characters lost when uploaded from MS Teams #6817

Closed LuisM000 closed 2 months ago

LuisM000 commented 4 months ago

Version

Lastest

Describe the bug

When I upload an attachment from Microsoft Teams with certain special characters, such as a '+', the attachment "disappears" when it is received in the bot's backend.

For example, uploading a file with a "normal" name like test.txt works as expected, and I receive the following in the bot's backend:

{
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.teams.file.download.info",
            "content": {
                "downloadUrl": "https://ckm-my.sharepoint.com/personal/xxxxxx/_layouts/15/download.aspx?UniqueId=xxxxx-xxxx-xxxx-xxxx-xxxxx&Translate=false&tempauth=v1.xxxx.xxxx.xxxx&ApiVersion=2.0",
                "uniqueId": "xxxx-xxxx-xxxx-xxxx-xxxxx",
                "fileType": "txt"
            },
            "contentUrl": "https://ckm-my.sharepoint.com/personal/xxxxxx/Documents/Microsoft Teams Chat Files/test.txt",
            "name": "test.txt"
        },
        {
            "contentType": "text/html",
            "content": ""
        }
    ],
    "type": "message",
    "timestamp": "2024-07-11T10:29:11.4680572Z",
    "localTimestamp": "2024-07-11T12:29:11.4680572+02:00",
    "id": "1720693751445",
    "channelId": "msteams",
    // ....
}

However, if I upload a file with a name like test+.txt, I only receive the following:

{
    "attachments": [
        {
            "contentType": "text/html",
            "content": ""
        }
    ],
    "type": "message",
    "timestamp": "2024-07-11T10:36:45.0287287Z",
    "localTimestamp": "2024-07-11T12:36:45.0287287+02:00",
    "id": "1720694205007",
    "channelId": "msteams",
    //...
}

To Reproduce

Steps to reproduce the behavior:

  1. Use the basic example from BotBuilder-Samples.
  2. Upload a file with a normal name (e.g., test.txt) from Microsoft Teams.
  3. Observe the attachment received in the bot's backend.
  4. Upload a file with a special character in the name (e.g., test+.txt) from Microsoft Teams.
  5. Observe the attachment received in the bot's backend.

Expected behavior

Attachments with special characters in their names should be processed correctly and received in the bot's backend just like attachments with normal names.

Screenshots

N/A

Additional context

This issue has also been posted on Stack Overflow.

rliberoff commented 4 months ago

I also have this very same issue. We cannot control the name of the files the user's upload from Teams to the bot's backend. Please help!

MarioRamosEs commented 4 months ago

Same issue here :(

dmvtech commented 3 months ago

I can reproduce. As it is happening on the Teams side (before even getting to the bot), I am investigating on where/how to have this handled.

marsanga commented 3 months ago

Hello there! Are there any news on this?

rliberoff commented 3 months ago

Is there a ETA or update on this issue?

ceciliaavila commented 2 months ago

Hi @tracyboehrer, this is the same issue reported in #4750. It's on MS Teams' side, the bot is not receiving the attachment when there are special characters in its name. image

tracyboehrer commented 2 months ago

OP should refer this to the Teams Samples or Teams AI SDK repo.