onSendFileMessage not working when type is set to "image"

I’m creating a custom <Input /> for my group channels so I am able to automate tests easier around it. While doing so I noticed that sending this object

      uri: photo.path,
      size: photo.size,
      name: photo.mime,
      type: "image",

that the resulting message type === file when rending in the list.

After doing some digging in the codebase it looks like
regex.ts#L56 is the root issue. If I change the type above to image/ or use the photo.mime prop it works. This could probably be solved with more type definitions or improved docs on how to handle this particular use case.

[UIKit Version]
// What version of the SDK are you using? 2.0.0

[Current impact]
Images are not showing in messages list and when a user taps on them they are taken to their web browser to view the image.

Hi @Cory_Cunningham,

As you discovered, this is expecting a MIME type, and thus purely passing image is not expected to work. I’ll talk with the team about trying to make that more explicitly clear.

Thanks for the response!

I feel like a simple (outsider) solution would be to have a simple type attached to that function that tells us via intellisense (or digging in the code) what is expected.

I’m sure you’re thinking of better solutions though since it’s your code! :slight_smile: