turt2live / matrix-dimension

An open source integration manager for matrix clients, like Element.
https://dimension.t2bot.io
GNU General Public License v3.0
433 stars 110 forks source link

Bad JSON value: float #396

Closed yingziwu closed 3 years ago

yingziwu commented 3 years ago

PLEASE NOTE: make sure the bug exists in the latest patch level of the project. For instance, if you are running a 2.x version of Apostrophe, you should use the latest in that major version to confirm the bug.

To Reproduce

Step by step instructions to reproduce the behavior:

  1. Add sticker pack: https://t.me/addstickers/ARU_full
  2. Send any stricker.
  3. Get error Bad JSON value: float image

Expected behavior

Sent successfully.

Describe the bug

Request body

{
  "url": "mxc://bgme.me/TNjZMpQaWwzombrltngmEdGU",
  "info": {
    "mimetype": "image/png",
    "w": 256,
    "h": 210.5,
    "thumbnail_url": "mxc://bgme.me/TNjZMpQaWwzombrltngmEdGU",
    "thumbnail_info": {
      "mimetype": "image/png",
      "w": 256,
      "h": 210.5
    },
    "dimension": {
      "license": {
        "name": "Telegram",
        "urlPath": "/licenses/telegram-imported.txt"
      },
      "author": {
        "type": "telegram",
        "name": "Telegram",
        "reference": "https://t.me/addstickers/ARU_full"
      }
    }
  },
  "body": "👓"
}

https://github.com/matrix-org/synapse/blob/9dde9c9f01ff8ed4c60314f10d97261739ea0547/synapse/events/utils.py#L486