Clear link descriptions before re-computing

(cherry picked from commit 6224dbcd95d6a0ba6badb5f5cf5dca8fd600c82d)
This commit is contained in:
Stephen Paul Weber 2024-09-30 15:42:52 -05:00 committed by Arne
parent 17d57e34d2
commit f32727459b
2 changed files with 5 additions and 0 deletions

View file

@ -1391,6 +1391,10 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
return result;
}
public synchronized void clearLinkDescriptions() {
this.payloads.removeAll(getLinkDescriptions());
}
public String getMimeType() {
String extension;
if (relativeFilePath != null) {

View file

@ -1948,6 +1948,7 @@ public class XmppConnectionService extends Service {
boolean waitForPreview = false;
if (getPreferences().getBoolean("send_link_previews", true) && !previewedLinks && !message.needsUploading() && message.getEncryption() != Message.ENCRYPTION_AXOLOTL) {
message.clearLinkDescriptions();
final List<URI> links = message.getLinks();
if (!links.isEmpty()) {
waitForPreview = true;