Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m.image height and widget are float, not int #363

Closed
anoadragon453 opened this issue Jul 15, 2019 · 19 comments
Closed

m.image height and widget are float, not int #363

anoadragon453 opened this issue Jul 15, 2019 · 19 comments
Assignees

Comments

@anoadragon453
Copy link
Member

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: mautrix/whatsapp#80

They should be converted to floats to remain spec compliant.

@bmarty
Copy link
Member

bmarty commented Jul 16, 2019

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

@anoadragon453
Copy link
Member Author

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.

@tulir
Copy link
Contributor

tulir commented Jul 16, 2019

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.

@ganfra
Copy link
Member

ganfra commented Jul 17, 2019

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.

@bmarty
Copy link
Member

bmarty commented Jul 17, 2019

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

@tulir
Copy link
Contributor

tulir commented Jul 17, 2019

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

@anoadragon453
Copy link
Member Author

Pixel XL, Android 9.0

@bmarty
Copy link
Member

bmarty commented Jul 18, 2019

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

@bmarty
Copy link
Member

bmarty commented Sep 24, 2019

Hi @anoadragon453 can we close this issue?

@tulir
Copy link
Contributor

tulir commented Sep 24, 2019

The issue still seems to be there on build 936

@MTRNord
Copy link

MTRNord commented Jun 29, 2020

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?)

@tulir
Copy link
Contributor

tulir commented Jun 29, 2020

(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: #363 (comment))

@MTRNord
Copy link

MTRNord commented Jun 29, 2020

@tulir whoops ok. Yeah but this still happens anyway

@auscompgeek
Copy link

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

@ganfra
Copy link
Member

ganfra commented Jul 20, 2020

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 :)

@ganfra ganfra self-assigned this Jul 20, 2020
@diller444
Copy link

Huawei P Smart Z, Android 10.0

@bmarty
Copy link
Member

bmarty commented Aug 3, 2020

Should be fixed by #1766

@bmarty bmarty closed this as completed Aug 3, 2020
@tulir
Copy link
Contributor

tulir commented Aug 3, 2020

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

@diller444
Copy link

still the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants