mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-11 04:33:02 +02:00
Fix m->d encrypted files
This commit is contained in:
parent
d0ac5b58a7
commit
a05868f418
3 changed files with 10 additions and 7 deletions
|
@ -37,16 +37,15 @@ async function resolvePendingFiles(message) {
|
|||
if ("key" in p) {
|
||||
// Encrypted file
|
||||
const d = crypto.createDecipheriv("aes-256-ctr", Buffer.from(p.key, "base64url"), Buffer.from(p.iv, "base64url"))
|
||||
// @ts-ignore
|
||||
await api.getMedia(p.mxc).then(res => res.body.pipe(d))
|
||||
await api.getMedia(p.mxc).then(res => Readable.fromWeb(res.body).pipe(d))
|
||||
return {
|
||||
name: p.name,
|
||||
file: d
|
||||
}
|
||||
} else {
|
||||
// Unencrypted file
|
||||
/** @type {Readable} */ // @ts-ignore
|
||||
const body = await api.getMedia(p.mxc).then(res => res.body)
|
||||
/** @type {Readable} */
|
||||
const body = await api.getMedia(p.mxc).then(res => Readable.fromWeb(res.body))
|
||||
return {
|
||||
name: p.name,
|
||||
file: body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue