Add plaintext hash to existing message attachments

This commit is contained in:
trevor-signal 2024-01-02 15:14:11 -05:00 committed by GitHub
parent e28a07588e
commit dcf52aa619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 122 additions and 42 deletions

View file

@ -11,6 +11,7 @@ import * as logger from '../../logging/log';
import { fakeAttachment } from '../../test-both/helpers/fakeAttachment';
import { DAY } from '../../util/durations';
import { migrateDataToFileSystem } from '../../util/attachments/migrateDataToFilesystem';
describe('Attachment', () => {
describe('getFileExtension', () => {
@ -420,6 +421,8 @@ describe('Attachment', () => {
contentType: MIME.IMAGE_JPEG,
path: 'abc/abcdefgh123456789',
fileName: 'foo.jpg',
plaintextHash:
'9dac71e94805b04964a99011d74da584301362712570e98354d535c3cd3fdfca',
size: 1111,
};
@ -429,7 +432,7 @@ describe('Attachment', () => {
return 'abc/abcdefgh123456789';
};
const actual = await Attachment.migrateDataToFileSystem(input, {
const actual = await migrateDataToFileSystem(input, {
writeNewAttachmentData,
logger,
});
@ -451,7 +454,7 @@ describe('Attachment', () => {
const writeNewAttachmentData = async () => 'abc/abcdefgh123456789';
const actual = await Attachment.migrateDataToFileSystem(input, {
const actual = await migrateDataToFileSystem(input, {
writeNewAttachmentData,
logger,
});
@ -469,7 +472,7 @@ describe('Attachment', () => {
const writeNewAttachmentData = async () => 'abc/abcdefgh123456789';
const actual = await Attachment.migrateDataToFileSystem(input, {
const actual = await migrateDataToFileSystem(input, {
writeNewAttachmentData,
logger,
});

View file

@ -376,6 +376,8 @@ describe('Message', () => {
path: 'abc/abcdefg',
fileName: 'test\uFFFDfig.exe',
size: 1111,
plaintextHash:
'f191b44995ef464dbf1943bc686008c08e95dab78cbdfe7bb5e257a8214d5b15',
},
],
hasAttachments: 1,