mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-26 03:18:17 +01:00
Padded attachments, attachments v2
* Handle incoming padded attachments * Attachments v2 - multipart form POST, and direct CDN GET access * Pad outgoing attachments before encryption (disabled for now)
This commit is contained in:
@@ -1234,17 +1234,19 @@ MessageReceiver.prototype.extend({
|
||||
window.Signal.Crypto.base64ToArrayBuffer(digest)
|
||||
);
|
||||
|
||||
if (!size || size !== data.byteLength) {
|
||||
if (!size) {
|
||||
throw new Error(
|
||||
`downloadAttachment: Size ${size} did not match downloaded attachment size ${
|
||||
`downloadAttachment: Size was not provided, actual size was ${
|
||||
data.byteLength
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
const typedArray = window.Signal.Crypto.getFirstBytes(data, size);
|
||||
|
||||
return {
|
||||
..._.omit(attachment, 'digest', 'key'),
|
||||
data,
|
||||
data: window.Signal.Crypto.typedArrayToArrayBuffer(typedArray),
|
||||
};
|
||||
},
|
||||
handleAttachment(attachment) {
|
||||
|
||||
Reference in New Issue
Block a user