fix: preserve cipher edit time during auto repair

This commit is contained in:
rootphantomer
2026-06-09 12:14:11 +08:00
committed by shuaiplus
parent d4749d3f82
commit 1a10df4a18
2 changed files with 15 additions and 4 deletions
+9 -2
View File
@@ -927,6 +927,7 @@ export async function repairCipherUriChecksums(
? cipher.fields.map(({ decName: _decName, decValue: _decValue, ...field }) => field)
: null,
lastKnownRevisionDate: cipher.revisionDate ?? null,
preserveRevisionDate: true,
};
if (keys.key) payload.key = keys.key;
@@ -1091,7 +1092,9 @@ export async function repairCipherKeyMismatches(
if (!cipher?.id || !looksLikeCipherString(cipher.key)) continue;
if (!(await hasItemKeyFieldMismatch(cipher, userEnc, userMac))) continue;
if (hasUnresolvedEncryptedFields(cipher)) continue;
await updateCipher(authedFetch, session, cipher, draftFromDecryptedCipher(cipher));
await updateCipher(authedFetch, session, cipher, draftFromDecryptedCipher(cipher), {
preserveRevisionDate: true,
});
repaired += 1;
}
@@ -1225,9 +1228,13 @@ export async function updateCipher(
authedFetch: AuthedFetch,
session: SessionState,
cipher: Cipher,
draft: VaultDraft
draft: VaultDraft,
extraPayload?: Record<string, unknown>
): Promise<Cipher> {
const payload = await buildCipherPayload(session, draft, cipher);
if (extraPayload) {
Object.assign(payload, extraPayload);
}
const resp = await authedFetch(`/api/ciphers/${encodeURIComponent(cipher.id)}`, {
method: 'PUT',