Update conversion of Uint8Array to Readable for in-memory attachments
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
parent
2b1990b293
commit
8e3c6c23d7
2 changed files with 7 additions and 1 deletions
|
@ -126,7 +126,7 @@ export async function encryptAttachmentV2({
|
|||
try {
|
||||
const source =
|
||||
'data' in plaintext
|
||||
? Readable.from(plaintext.data)
|
||||
? Readable.from([Buffer.from(plaintext.data)])
|
||||
: createReadStream(plaintext.absolutePath);
|
||||
|
||||
await pipeline(
|
||||
|
|
|
@ -675,6 +675,12 @@ describe('Crypto', () => {
|
|||
data: FILE_CONTENTS,
|
||||
plaintextHash: FILE_HASH,
|
||||
});
|
||||
|
||||
// also works if data is raw Uint8Array rather than a buffer
|
||||
await testV2RoundTripData({
|
||||
data: new Uint8Array(FILE_CONTENTS),
|
||||
plaintextHash: FILE_HASH,
|
||||
});
|
||||
});
|
||||
|
||||
it('v2 roundtrips large file from disk', async () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue