mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-18 07:36:00 +01:00
Allow incremental playback for attachments with plaintextHash
This commit is contained in:
@@ -27,6 +27,7 @@ export function getLocalAttachmentUrl(
|
||||
AttachmentType,
|
||||
| 'contentType'
|
||||
| 'digest'
|
||||
| 'plaintextHash'
|
||||
| 'downloadPath'
|
||||
| 'incrementalMac'
|
||||
| 'chunkSize'
|
||||
@@ -87,10 +88,17 @@ export function getLocalAttachmentUrl(
|
||||
}
|
||||
url.searchParams.set('key', attachment.key);
|
||||
|
||||
if (!attachment.digest) {
|
||||
throw new Error('getLocalAttachmentUrl: Missing attachment digest!');
|
||||
// Attachments restored from backup / link & sync may have plaintextHash but not
|
||||
// digest
|
||||
if (attachment.plaintextHash) {
|
||||
url.searchParams.set('plaintextHash', attachment.plaintextHash);
|
||||
} else if (attachment.digest) {
|
||||
url.searchParams.set('digest', attachment.digest);
|
||||
} else {
|
||||
throw new Error(
|
||||
'getLocalAttachmentUrl: Missing attachment plaintextHash and digest!'
|
||||
);
|
||||
}
|
||||
url.searchParams.set('digest', attachment.digest);
|
||||
|
||||
if (!attachment.incrementalMac) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user