1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 06:13:38 +00:00

user decryption parsing error bug (#16346)

This commit is contained in:
Maciej Zieniuk
2025-09-08 22:56:22 +02:00
committed by GitHub
parent c017e3c676
commit 0d6a67fc81
2 changed files with 10 additions and 5 deletions

View File

@@ -35,9 +35,14 @@ describe("UserDecryptionResponse", () => {
); );
}); });
it("should create response when masterPasswordUnlock is not provided", () => { it.each([null, undefined, "should be object type"])(
const userDecryptionResponse = new UserDecryptionResponse({}); "should create response when masterPasswordUnlock is %s",
(masterPasswordUnlock) => {
const userDecryptionResponse = new UserDecryptionResponse({
MasterPasswordUnlock: masterPasswordUnlock,
});
expect(userDecryptionResponse.masterPasswordUnlock).toBeUndefined(); expect(userDecryptionResponse.masterPasswordUnlock).toBeUndefined();
}); },
);
}); });

View File

@@ -8,7 +8,7 @@ export class UserDecryptionResponse extends BaseResponse {
super(response); super(response);
const masterPasswordUnlock = this.getResponseProperty("MasterPasswordUnlock"); const masterPasswordUnlock = this.getResponseProperty("MasterPasswordUnlock");
if (masterPasswordUnlock != null || typeof masterPasswordUnlock === "object") { if (masterPasswordUnlock != null && typeof masterPasswordUnlock === "object") {
this.masterPasswordUnlock = new MasterPasswordUnlockResponse(masterPasswordUnlock); this.masterPasswordUnlock = new MasterPasswordUnlockResponse(masterPasswordUnlock);
} }
} }