mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[PM-21644] Cannot retrieve attachment from bw serve (#14806)
* Modified saveAttachmenttofIle to implement callback attachment content decryption * renamed parameter
This commit is contained in:
@@ -11,6 +11,7 @@ import { ErrorResponse } from "@bitwarden/common/models/response/error.response"
|
||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer";
|
||||
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||
import { SendAccess } from "@bitwarden/common/tools/send/models/domain/send-access";
|
||||
@@ -98,10 +99,16 @@ export class SendReceiveCommand extends DownloadCommand {
|
||||
this.sendAccessRequest,
|
||||
apiUrl,
|
||||
);
|
||||
|
||||
const decryptBufferFn = async (resp: globalThis.Response) => {
|
||||
const encBuf = await EncArrayBuffer.fromResponse(resp);
|
||||
return this.encryptService.decryptFileData(encBuf, this.decKey);
|
||||
};
|
||||
|
||||
return await this.saveAttachmentToFile(
|
||||
downloadData.url,
|
||||
this.decKey,
|
||||
response?.file?.fileName,
|
||||
decryptBufferFn,
|
||||
options.output,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user