New option: Disable automatic attachment downloads

This commit is contained in:
Scott Nonnenberg
2025-03-04 10:09:43 +10:00
committed by GitHub
parent ee63cfc277
commit f163ada463
86 changed files with 3043 additions and 1030 deletions

View File

@@ -181,7 +181,7 @@ describe('processDataMessage', () => {
assert.strictEqual(out.profileKey, 'Khc3');
});
it('should process quote', () => {
it('should process quote, dropping second attachment', () => {
const out = check({
quote: {
id: Long.fromNumber(1),
@@ -190,7 +190,12 @@ describe('processDataMessage', () => {
attachments: [
{
contentType: 'image/jpeg',
fileName: 'image.jpg',
fileName: 'image1.jpg',
thumbnail: UNPROCESSED_ATTACHMENT,
},
{
contentType: 'image/jpeg',
fileName: 'image2.jpg',
thumbnail: UNPROCESSED_ATTACHMENT,
},
],
@@ -204,7 +209,7 @@ describe('processDataMessage', () => {
attachments: [
{
contentType: IMAGE_JPEG,
fileName: 'image.jpg',
fileName: 'image1.jpg',
thumbnail: PROCESSED_ATTACHMENT,
},
],
@@ -213,7 +218,7 @@ describe('processDataMessage', () => {
});
});
it('should process contact', () => {
it('should process contact, dropping second contact', () => {
const out = check({
contact: [
{
@@ -234,8 +239,36 @@ describe('processDataMessage', () => {
{
avatar: { avatar: PROCESSED_ATTACHMENT, isProfile: false },
},
]);
});
it('should process preview, dropping second preview', () => {
const out = check({
preview: [
{
description:
'Say "hello" to a different messaging experience. An unexpected focus on privacy, combined with all of the features you expect.',
image: UNPROCESSED_ATTACHMENT,
title: 'Signal Private Messenger #1',
url: 'https://signal.org',
},
{
description: 'Say "hello" again',
image: UNPROCESSED_ATTACHMENT,
title: 'Signal Private Messenger #2',
url: 'https://signal.org',
},
],
});
assert.deepStrictEqual(out.preview, [
{
avatar: { avatar: PROCESSED_ATTACHMENT, isProfile: true },
date: undefined,
description:
'Say "hello" to a different messaging experience. An unexpected focus on privacy, combined with all of the features you expect.',
image: PROCESSED_ATTACHMENT,
title: 'Signal Private Messenger #1',
url: 'https://signal.org',
},
]);
});