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

Thumbnails of images uploaded via API return invalid width #1108

Open
daedric7 opened this issue May 30, 2023 · 0 comments
Open

Thumbnails of images uploaded via API return invalid width #1108

daedric7 opened this issue May 30, 2023 · 0 comments

Comments

@daedric7
Copy link

daedric7 commented May 30, 2023

Describe the bug
I have several scripts downloading images from websites and posting them in a few rooms.

The image miniature is displayed correctly by Element.

Yet, hydrogen tries to use the dynamic thumbnail to generate the thumbnail, and fails with both width and height being NaN, resulting in:

{"errcode":"M_INVALID_PARAM","error":"Query parameter 'width' must be an integer"}

There are differences between a image uploaded via API and via Element:

API:

{
  "type": "m.room.message",
  "sender": "@dabot:aguiarvieira.pt",
  "content": {
    "body": "oj7lzggmp03b1.png",
    "msgtype": "m.image",
    "filename": "oj7lzggmp03b1.png",
    "url": "mxc://aguiarvieira.pt/PKYZYDmyTYeggoktiRTRMgtE"
  },
  "origin_server_ts": 1685473939679,
  "unsigned": {
    "age": 47
  },
  "event_id": "$9l9xn_wD3g7HgyrEtN-5YAAaNnlxtrYbADJGg2upQGA",
  "room_id": "!VlADlaAKzYXdFhLQhZ:aguiarvieira.pt"
}

Element:

{
  "type": "m.room.message",
  "sender": "@daedric:aguiarvieira.pt",
  "content": {
    "body": "png-transparent-penguin-tux-design-logo-linux-penguin-animals-logo-vertebrate.png",
    "info": {
      "size": 18070,
      "mimetype": "image/png",
      "w": 920,
      "h": 550,
      "xyz.amorgan.blurhash": "LKRfd[ad.TtSS6bHs,jsyEkCMwad"
    },
    "msgtype": "m.image",
    "url": "mxc://aguiarvieira.pt/gAasggirXwIdcCYjVyyUmsyp"
  },
  "origin_server_ts": 1685462095591,
  "unsigned": {
    "age": 103
  },
  "event_id": "$QHBYeJYqXbwmJ0Q7y7anXP3IaaA0s9AJtGOTZgs3i8Y",
  "room_id": "!BhYbDqbkGKjvDHvnTq:aguiarvieira.pt"
}

To Reproduce
Steps to reproduce the behavior:

  1. Upload image via curl or any other tool that uses the Matrix API
  2. Open respective room
  3. Notice absense of thumbnail
  4. Confirm that clicking the missing thumbnail/link opens the original image

Expected behavior
Thumbnails for images without extra info should attempt to use a width proportional to screen, or a static value.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Chrome
  • Latest

Smartphone (please complete the following information):

  • Device: OP7
  • OS: Android 13
  • Browser Chrome
  • Version latest

Additional context

Ex. URL : https://aguiarvieira.pt/_matrix/media/r0/thumbnail/aguiarvieira.pt/cRiTRpNSpfBbniXepLFzWKxt?width=NaN&height=NaN&method=scale

@daedric7 daedric7 changed the title Thumbnails of images uploaded via API return 404 Thumbnails of images uploaded via API return invalid width May 30, 2023
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

1 participant