rwth-acis / las2peer-social-bot-manager-service

las2peer Social Bot Manager Service
Other
3 stars 3 forks source link

[ENH] Picture sent to Rocket chat not shown #56

Open lakhoune opened 3 years ago

lakhoune commented 3 years ago
  1. Summary - The pictures which the social bot manager service sends to rocket chat are not displayed in chat
  2. Bug Details:

    1. What? - The bot service sends a message to rocket chat but rocket chat is not showing it in the chat of the user, as if there was no response

    2021-06-01 23_17_01-(4) Rocket Chat and 6 more pages - Personal - Microsoft​ Edge

    1. Where? - Rocket chat, social bot manager In my case this was the MobSOS bot
    2. When?/How often? - always
    3. How?/Current state - Write a message to the MobSOS bot telling it to make a visualization. The bot will ask for a measure name. Write list all. Then copy and paste one of the measures in the list in the chat.
  3. (Optional) Fixed state - Making the same request to the mensa bot which uses the same underlying bot model for visualizations, the bot answers with the picture just fine image
Aran30 commented 3 years ago

I took a look at it. This is actually a problem with how the files receive their type extensions when converting from base64 to file. When receiving a file from a service, the "fileType" attribute needs to exactly match the file extension. In your case, you fileType was "image/png", which when appended to your file called "visual" for example, leads to visual.image/png which of course does not work. For a quick fix for your service, just set the fileType to "png" before responding to the social bot manager ;). The problem with the Slack implementation currently, is that each file you receive from the bot, is of the type file, which is not the best option. In this case, the fastest "fix" from my side, would be to more clearly document the json response which is expected by the service.

lakhoune commented 3 years ago

Okay. But I think it would be better in the future to keep the filetype image/png and then check the filename if it has the extension (e.g. myImage.png) and if the extension is missing (e.g. image) append the right extension based on the filetype