1
0
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:
SmithThe4th
2025-05-22 09:15:30 -04:00
committed by GitHub
parent 068c63e891
commit 46a0b709fe
3 changed files with 28 additions and 16 deletions

View File

@@ -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,
);
}