mirror of
https://github.com/bitwarden/browser
synced 2026-02-20 03:13:55 +00:00
Update collectionIds handling in DefaultCipherFormService to preserve new values during cipher updates (#18650)
This commit is contained in:
@@ -76,6 +76,9 @@ export class DefaultCipherFormService implements CipherFormService {
|
||||
.then((res) => res.cipher);
|
||||
} else {
|
||||
// Updating a cipher with collection changes is not supported with a single request currently
|
||||
// Save the new collectionIds before overwriting
|
||||
const newCollectionIdsToSave = cipher.collectionIds;
|
||||
|
||||
// First update the cipher with the original collectionIds
|
||||
cipher.collectionIds = config.originalCipher.collectionIds;
|
||||
const newCipher = await this.cipherService.updateWithServer(
|
||||
@@ -86,7 +89,7 @@ export class DefaultCipherFormService implements CipherFormService {
|
||||
);
|
||||
|
||||
// Then save the new collection changes separately
|
||||
newCipher.collectionIds = cipher.collectionIds;
|
||||
newCipher.collectionIds = newCollectionIdsToSave;
|
||||
|
||||
// TODO: Remove after migrating all SDK ops
|
||||
const { cipher: encryptedCipher } = await this.cipherService.encrypt(newCipher, activeUserId);
|
||||
|
||||
Reference in New Issue
Block a user