Giter VIP home page Giter VIP logo

Comments (3)

tulir avatar tulir commented on May 23, 2024

The problem might be not having python-magic installed, and thus the bot sending the wrong mime type when uploading the file.

from xkcd.

UndeadKernel avatar UndeadKernel commented on May 23, 2024

Thanks for the suggestions @tulir.
After installing python-magic (in the maubot python environment), I still have the same issue.

The image is uploaded correctly to the matrix media folder and I can see it correctly with a image viewing program.

Any clue how I could debug this issue?

from xkcd.

mozzieongit avatar mozzieongit commented on May 23, 2024

Hi, I had the same issue.
It seemed like the bot was uploading the PNG image as JSON data. I did a curl on the image uploaded by the bot:

HTTP/1.1 200 OK
[...]
Content-Type: application/json; charset=UTF-8
Content-Length: 51409
[...]

curling a different picture (uploaded by me) results in the correct content-type: image/png

This only happened on the image sent when using !xkcd or !xkcd 2497 (as the current number) to get the latest image. When using !xkcd 1500 then the resulting image was displayed correctly.
I found that the row in media_cache of the bot database had an empty cell for mime_type.
I then deleted the media_cache row containing the file_name logic_gates.png (the broken image).
delete FROM "media_cache" where file_name = 'logic_gates.png'
After deleting the row I re-triggered the bot with !xkcd and the image loaded fine.

NOTE: I installed python-magic mid-way through, so I don't remember if the second image was loaded correctly because of that. The broken image was still broken after that until I deleted the cache entry.

TL;DR: installed python-magic, deleted broken images (empty mime_type) from bot database via the web management tool.

from xkcd.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.