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

Broken images being fetched #2

Open
UndeadKernel opened this issue Jan 20, 2020 · 3 comments
Open

Broken images being fetched #2

UndeadKernel opened this issue Jan 20, 2020 · 3 comments

Comments

@UndeadKernel
Copy link

Hey, it seems that the bot is fetching broken PNG images.
No matter if in the config I have the comics set to display inline or not, the comics are not correctly displayed. It seems that garbage bytes are being added to the fetched PNG file.

@tulir
Copy link
Member

tulir commented Feb 17, 2020

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

@UndeadKernel
Copy link
Author

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?

@mozzieongit
Copy link

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.

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

3 participants