From 69438a78c633ae21b08a5569125e22a3a79cad8d Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Fri, 4 Apr 2025 23:14:37 +0100 Subject: [PATCH] Fix bug where we didn't update hash on updates --- .../src/sync-operations/unrestricted-syncer.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts b/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts index c7e01cd6..43cb5c7c 100644 --- a/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts +++ b/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts @@ -236,6 +236,14 @@ export class UnrestrictedSyncer { const responseBytes = deserialize(response.contentBase64); contentHash = hash(responseBytes); + this.database.updateDocumentMetadata( + { + parentVersionId: response.vaultUpdateId, + hash: contentHash + }, + document + ); + await this.operations.write( actualPath, contentBytes, @@ -250,6 +258,14 @@ export class UnrestrictedSyncer { type: SyncType.UPDATE }); } + } else { + this.database.updateDocumentMetadata( + { + parentVersionId: response.vaultUpdateId, + hash: contentHash + }, + document + ); } this.tryIncrementVaultUpdateId(response.vaultUpdateId);