Fix race condition of client-side path deconflicting

This commit is contained in:
Andras Schmelczer 2025-11-29 17:28:03 +00:00
parent 952e89343a
commit 10bde4bc3a
4 changed files with 77 additions and 28 deletions

View file

@ -87,15 +87,6 @@ export class UnrestrictedSyncer {
contentBytes
});
this.database.updateDocumentMetadata(
{
parentVersionId: response.vaultUpdateId,
hash: contentHash,
remoteRelativePath: response.relativePath
},
document
);
// In case a document with the same name (but different ID) had existed remotely that we haven't known about
if (response.relativePath != originalRelativePath) {
this.logger.debug(
@ -107,6 +98,15 @@ export class UnrestrictedSyncer {
); // this can throw FileNotFoundError
}
this.database.updateDocumentMetadata(
{
parentVersionId: response.vaultUpdateId,
hash: contentHash,
remoteRelativePath: response.relativePath
},
document
);
this.database.addSeenUpdateId(response.vaultUpdateId);
this.updateCache(
response.vaultUpdateId,