fix: Bug - Images and files in chat doesn't load

This commit is contained in:
2026-07-14 11:27:19 +02:00
parent 41ebaf2407
commit 20d7f22fd2
21 changed files with 631 additions and 38 deletions
@@ -13,6 +13,7 @@ import { yieldToAttachmentHydrationLoop } from '../../domain/logic/attachment-bl
import {
buildAttachmentDisplayPinKey,
collectMessageIdsForInactiveRoomBlobRelease,
isAttachmentDisplayPinned,
shouldRevokeDisplayBlobForAttachment
} from '../../domain/logic/attachment-blob-eviction.rules';
import {
@@ -214,6 +215,8 @@ export class AttachmentManagerService {
return;
}
this.cancelDisplayHydrationForMessage(messageId);
let hasChanges = false;
for (const attachment of this.runtimeStore.getAttachmentsForMessage(messageId)) {
@@ -231,6 +234,20 @@ export class AttachmentManagerService {
}
}
cancelDisplayHydrationForMessage(messageId: string): void {
if (!messageId) {
return;
}
for (const attachment of this.runtimeStore.getAttachmentsForMessage(messageId)) {
if (isAttachmentDisplayPinned(messageId, attachment.id, this.pinnedDisplayBlobKeys)) {
continue;
}
this.persistence.cancelDisplayHydration(attachment);
}
}
releaseDisplayBlobsForInactiveRooms(activeRoomId: string | null): void {
const messageIds = collectMessageIdsForInactiveRoomBlobRelease(
Array.from(this.runtimeStore.getAttachmentEntries(), ([messageId]) => messageId),
@@ -256,9 +273,11 @@ export class AttachmentManagerService {
}
handleFileAnnounce(payload: FileAnnouncePayload): void {
const isNew = this.transfer.handleFileAnnounce(payload);
this.transfer.handleFileAnnounce(payload);
if (isNew && payload.messageId && payload.file?.id) {
if (payload.messageId && payload.file?.id) {
// Re-announces are recovery signals too: a host may have come back after
// an earlier file-not-found, so re-run the guarded auto-download path.
this.queueAutoDownloadsForMessage(payload.messageId, payload.file.id);
}
}