mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge

Home Page:https://maunium.net/go/mautrix-whatsapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avatars are not redownloaded if mediaapi database is purged and the media files are deleted

Xinayder opened this issue · comments

I'm using Dendrite and self-host some Mautrix bridges. One day I decided to delete the media files from the homeserver media storage and all bridged profile avatars were gone (as expected, since they were pointing to non-existent files). A few months later, I tried to purge the mediaapi database, thinking it would download the avatars again, but it didn't work either.

I have tried using the sync groups --avatars command, however, this doesn't work either. The avatars are still blank, and the only way to redownload them for groups is to completely delete the portal room and create it again. Unfortunately, doing the same doesn't work for normal contacts.

I'm not really sure if this is a homeserver problem or the bridge problem (maybe both?), but there could be a commad for Mautrix bridges to redownload the avatar files, or it could automatically try to download them again if the file is not found on the mediaapi repository.

This happens on both Go and Python bridges, as I am hosting mautrix-whatsapp, mautrix-facebook and mautrix-instagram.

I've created an issue on the Dendrite repository as well: matrix-org/dendrite#3179

You just need to manually clear the urls in the puppet and portal tables

Okay, that seems like a workaround. Couldn't this be kept open as an improvement proposal? Would you be willing to accept a PR that adds a command that can purge the avatar URLs?

EDIT: I have manually deleted the MXC urls in the puppet and portal tables, what else do I need to do to make the bridges download the avatars again?

EDIT2: managed to fix it for WhatsApp, in case anyone needs it:

update puppet set avatar_url = null, avatar_set = false;
update portal set avatar_url = null, avatar_set = false;

for Python-based bridges:

update puppet set photo_mxc = null, avatar_set = false;
update portal set avatar_url = null, avatar_set = false;