Various improvements #169

Merged
schmelczer merged 78 commits from asch/saturday into main 2025-11-30 15:24:52 +00:00
Showing only changes of commit 4e88fc9211 - Show all commits

Handle move on create

Andras Schmelczer 2025-11-22 21:08:16 +00:00

View file

@ -79,9 +79,10 @@ export class UnrestrictedSyncer {
); // this can throw FileNotFoundError ); // this can throw FileNotFoundError
const contentHash = hash(contentBytes); const contentHash = hash(contentBytes);
const originalRelativePath = document.relativePath;
const response = await this.syncService.create({ const response = await this.syncService.create({
documentId: document.documentId, documentId: document.documentId,
relativePath: document.relativePath, relativePath: originalRelativePath,
contentBytes contentBytes
}); });
@ -93,6 +94,15 @@ export class UnrestrictedSyncer {
}, },
document 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) {
await this.operations.move(
document.relativePath,
response.relativePath
); // this can throw FileNotFoundError
}
this.database.addSeenUpdateId(response.vaultUpdateId); this.database.addSeenUpdateId(response.vaultUpdateId);
this.updateCache( this.updateCache(
response.vaultUpdateId, response.vaultUpdateId,