BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

There is an issue with attaching files inside the bot for the user

Open Mohammadhiasat opened this issue 1 year ago • 3 comments

code of attachment:

def create_file_attachment(self, file_path): with open(file_path, "rb") as file_stream: file_data = file_stream.read() attachment = Attachment( name=os.path.basename(file_path), content_type="application/octet-stream",
content=file_data ) return attachment

problem:

# the bot will send a docx file as an attachment to the user 
# but the attachment can't be downloaded by the user in the emulator(download button is not available)

Image

Image

needs:

the attachment can be downloaded by the user in the emulator

Mohammadhiasat avatar Feb 05 '25 10:02 Mohammadhiasat

Can you tell me which version of Emulator it is that you are using?

Also, this looks like the bot is built with botbuilder-python. Is this correct? If so, can you tell me which version of that you are using? Can you include all the relevant code for the activity being sent that included the attachment so I can try and repro this?

stevkan avatar Feb 06 '25 23:02 stevkan

Hello, how are you? I am using version 4. And yes, that's correct, the bot is built using Bot Builder Python. Yes, of course, I will send you the part that includes the attachment code.

code of attachment:

def create_file_attachment(self, file_path):
with open(file_path, "rb") as file_stream:
file_data = file_stream.read()
attachment = Attachment(
    name=os.path.basename(file_path),
    content_type="application/octet-stream",
    content=file_data
)
return attachment

Mohammadhiasat avatar Feb 09 '25 12:02 Mohammadhiasat

@Mohammadhiasat - Thank you for your patience. I will attempt a repro with this and let you know what I find. If I have any additional questions, I will let you know.

stevkan avatar Mar 05 '25 00:03 stevkan