fix: Bug - Files lose host on reload

Persist large uploads under app data on publish and restore, and re-announce hosted attachments after reload so peers can download again.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-13 22:04:41 +02:00
co-authored by Cursor
parent 95259e8943
commit f0d79aa627
7 changed files with 210 additions and 9 deletions
@@ -2,6 +2,7 @@ import {
getWatchedAttachmentRoomIdFromUrl,
isDirectMessageAttachmentRoomId,
shouldCopyUploaderMediaToAppData,
shouldCopyLargeUploaderFileToAppData,
shouldStreamAttachmentReceiveToDisk,
canReceiveAttachment
} from './attachment.logic';
@@ -35,6 +36,16 @@ describe('attachment logic', () => {
}, '/home/ludde/video.mp4', true)).toBe(true);
});
it('copies any oversized upload with a source path into app data', () => {
expect(shouldCopyLargeUploaderFileToAppData({
size: 628 * 1024 * 1024
}, '/home/ludde/setup.exe', true)).toBe(true);
expect(shouldCopyLargeUploaderFileToAppData({
size: 1024
}, '/home/ludde/setup.exe', true)).toBe(false);
});
it('skips app-data copy for small uploads and missing source paths', () => {
expect(shouldCopyUploaderMediaToAppData({
size: 1024,