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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user