don't leak mimetype for encrypted attachments
This commit is contained in:
parent
96e46d154c
commit
262cc8936e
2 changed files with 3 additions and 3 deletions
|
@ -65,7 +65,7 @@ export async function encryptAttachment(platform, blob) {
|
||||||
const ciphertext = await crypto.aes.encryptCTR({jwkKey: key, iv, data: buffer});
|
const ciphertext = await crypto.aes.encryptCTR({jwkKey: key, iv, data: buffer});
|
||||||
const digest = await crypto.digest("SHA-256", ciphertext);
|
const digest = await crypto.digest("SHA-256", ciphertext);
|
||||||
return {
|
return {
|
||||||
blob: platform.createBlob(ciphertext, blob.mimeType),
|
blob: platform.createBlob(ciphertext, 'application/octet-stream'),
|
||||||
info: {
|
info: {
|
||||||
v: "v2",
|
v: "v2",
|
||||||
key,
|
key,
|
||||||
|
|
|
@ -98,10 +98,10 @@ export class AttachmentUpload {
|
||||||
}
|
}
|
||||||
let prefix = urlPath.substr(0, urlPath.lastIndexOf("url"));
|
let prefix = urlPath.substr(0, urlPath.lastIndexOf("url"));
|
||||||
setPath(`${prefix}info.size`, content, this._transferredBlob.size);
|
setPath(`${prefix}info.size`, content, this._transferredBlob.size);
|
||||||
setPath(`${prefix}info.mimetype`, content, this._unencryptedBlob.mimeType);
|
setPath(`${prefix}info.mimetype`, content, this._transferredBlob.mimeType);
|
||||||
if (this._isEncrypted) {
|
if (this._isEncrypted) {
|
||||||
setPath(`${prefix}file`, content, Object.assign(this._encryptionInfo, {
|
setPath(`${prefix}file`, content, Object.assign(this._encryptionInfo, {
|
||||||
mimetype: this._unencryptedBlob.mimeType,
|
mimetype: this._transferredBlob.mimeType,
|
||||||
url: this._mxcUrl
|
url: this._mxcUrl
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue