Handle move on create
This commit is contained in:
parent
c5ee8e1cd7
commit
4e88fc9211
1 changed files with 11 additions and 1 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue