mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-13 12:52:31 +00:00
Fixed:
- Deletion of files is now reliably synchronised.
This commit is contained in:
+11
-14
@@ -1469,20 +1469,25 @@ We can perform a command in this file.
|
|||||||
// let performPullFileAgain = false;
|
// let performPullFileAgain = false;
|
||||||
if (existDoc && existDoc._conflicts) {
|
if (existDoc && existDoc._conflicts) {
|
||||||
if (this.settings.writeDocumentsIfConflicted) {
|
if (this.settings.writeDocumentsIfConflicted) {
|
||||||
Logger(`Processing: ${file.path}: Conflicted revision has been deleted, but there were more conflicts. `, LOG_LEVEL_INFO);
|
Logger(`Processing: ${path}: Conflicted revision has been deleted, but there were more conflicts. `, LOG_LEVEL_INFO);
|
||||||
await this.processEntryDoc(docEntry, file, true);
|
await this.processEntryDoc(docEntry, file, true);
|
||||||
return;
|
return;
|
||||||
} else if (force != true) {
|
} else if (force != true) {
|
||||||
Logger(`Processing: ${file.path}: Conflicted revision has been deleted, but there were more conflicts...`);
|
Logger(`Processing: ${path}: Conflicted revision has been deleted, but there were more conflicts...`);
|
||||||
this.queueConflictCheck(file);
|
this.queueConflictCheck(path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If there are no conflicts, or forced to overwrite.
|
// If there are no conflicts, or forced to overwrite.
|
||||||
|
|
||||||
if (docEntry._deleted || docEntry.deleted || existDoc === false) {
|
if (docEntry._deleted || docEntry.deleted || existDoc === false) {
|
||||||
if (path != file.path) {
|
if (!file) {
|
||||||
Logger(`delete skipped: ${file.path} :Not exactly matched`, LOG_LEVEL_VERBOSE);
|
Logger(`delete skipped: ${path} :Already not exist on storage`, LOG_LEVEL_VERBOSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (file.path != path) {
|
||||||
|
Logger(`delete skipped: ${path} :Not exactly matched`, LOG_LEVEL_VERBOSE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (existDoc === false) {
|
if (existDoc === false) {
|
||||||
await this.deleteVaultItem(file);
|
await this.deleteVaultItem(file);
|
||||||
@@ -1495,15 +1500,7 @@ We can perform a command in this file.
|
|||||||
const localMtime = ~~((file?.stat?.mtime || 0) / 1000);
|
const localMtime = ~~((file?.stat?.mtime || 0) / 1000);
|
||||||
const docMtime = ~~(docEntry.mtime / 1000);
|
const docMtime = ~~(docEntry.mtime / 1000);
|
||||||
|
|
||||||
// const doc = await this.localDatabase.getDBEntry(path, { rev: docEntry._rev });
|
|
||||||
// if (doc === false) return;
|
|
||||||
const doc = existDoc;
|
const doc = existDoc;
|
||||||
// if (doc === false) {
|
|
||||||
// // The latest file
|
|
||||||
// await this.pullFile(path, null, force);
|
|
||||||
// // Logger(`delete skipped: ${file.path} :Not exactly matched`, LOG_LEVEL_VERBOSE);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (doc.datatype != "newnote" && doc.datatype != "plain") {
|
if (doc.datatype != "newnote" && doc.datatype != "plain") {
|
||||||
Logger(msg + "ERROR, Invalid datatype: " + path + "(" + doc.datatype + ")", LOG_LEVEL_NOTICE);
|
Logger(msg + "ERROR, Invalid datatype: " + path + "(" + doc.datatype + ")", LOG_LEVEL_NOTICE);
|
||||||
@@ -1519,7 +1516,7 @@ We can perform a command in this file.
|
|||||||
try {
|
try {
|
||||||
let outFile;
|
let outFile;
|
||||||
let isChanged = true;
|
let isChanged = true;
|
||||||
if (mode == "create") {
|
if (!file) {
|
||||||
const normalizedPath = normalizePath(path);
|
const normalizedPath = normalizePath(path);
|
||||||
await this.vaultAccess.vaultCreate(normalizedPath, writeData, { ctime: doc.ctime, mtime: doc.mtime, });
|
await this.vaultAccess.vaultCreate(normalizedPath, writeData, { ctime: doc.ctime, mtime: doc.mtime, });
|
||||||
outFile = this.vaultAccess.getAbstractFileByPath(normalizedPath) as TFile;
|
outFile = this.vaultAccess.getAbstractFileByPath(normalizedPath) as TFile;
|
||||||
|
|||||||
Reference in New Issue
Block a user