Element-android: m.image height and widget are float, not int

Created on 15 Jul 2019  路  19Comments  路  Source: vector-im/element-android

The spec mentions an m.images content.info.{h,w} must be integers, however when sending a message today my bridge broke complaining that they were floats: https://github.com/tulir/mautrix-whatsapp/issues/80

They should be converted to floats to remain spec compliant.

Most helpful comment

Note that this means RiotX Element Android cannot send images to v6 rooms.

All 19 comments

Hello @anoadragon453 ,

Are you sure the image was sent from RiotX? I've checked in the model, and we only use Int for all the data in ImageInfo (and since the beginning): https://github.com/vector-im/riotX-android/blob/develop/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/ImageInfo.kt

Benoit

Hm, it was sent from Riot X but it could be something on the bridge side? Odd though, since the bridge is written in Golang which is typed as well. I'll try the mautrix-whatsapp side again.

RiotX definitely sends all integers as floats, you can check the event json in the synapse db.

Maybe the problem is the JSON serializer? The Moshi repo had a bunch of int/float mixup issues, although none of them seemed to be about serialization with JsonClass.

I've just checked the json sent to the server, and all integers are well sent as integers.

{
   "msgtype": "m.image", 
   "body": "00000PORTRAIT_00000_BURST20190716211350956.jpg",
   "info": {
     "mimetype": "image\/jpeg",
     "w": 4032,
     "h": 3024,
    "size": 3839019,
     "rotation": 0,
    "orientation": 0
   },
}

And the data from the sync is identical.

@anoadragon453 any information about the device where riotx was installed? Model, os version, etc. A user agent would be ideal.
Thanks

My Huawei P20 Pro (Android 9.0) at least does it reliably for every image. Just sent one to #riotx:matrix.org.

"View Source" on Riot Web and RiotX converted them back to ints before showing, but old Riot Android view source and the server db definitely show floats

Pixel XL, Android 9.0

I think there is something strange in RiotX.

The view source shows:

When sending an image from RiotX:

  • on RiotX: Int
  • on Riot Android: Float
  • on Riot Web: Int
  • on Riot iOS: Int

When sending an image from Riot Android:

  • on RiotX: Int
  • on Riot Android: Int
  • on Riot Web: Int
  • on Riot iOS: Int

Hi @anoadragon453 can we close this issue?

The issue still seems to be there on build 936

This issue happened now too. See the above ruma issue. It seems like if you fetch the data via the /_matrix/client/r0/rooms/:room_id/event/:event_id endpoint it returns floats. But in riot-web they show up as integers. (Maybe in the sync synapse does make them ints?)

(Maybe in the sync synapse does make them ints?)

No, it's riot web showing you different content than what the event actually contains (as I said above: https://github.com/vector-im/riotX-android/issues/363#issuecomment-512128543)

@tulir whoops ok. Yeah but this still happens anyway

Note that this means RiotX Element Android cannot send images to v6 rooms.

Json actually doesn't really know between double or integer, it's just "numbers"
The client is responsible for typing then. In RiotX this issue is caused by loosing the information of the content when sending through Workers. It will be fixed in next release, thanks for pointing it :)

Huawei P Smart Z, Android 10.0

Should be fixed by #1766

Sending images to v6 rooms still doesn't work on latest develop (G-b3379)

still the same

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TR-SLimey picture TR-SLimey  路  3Comments

bmarty picture bmarty  路  3Comments

David-Else picture David-Else  路  3Comments

bmarty picture bmarty  路  3Comments

Bubu picture Bubu  路  3Comments