mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-21 23:26:37 +02:00
Resolve itemdb.d(295): Assertion failure
* Resolve core.exception.AssertError@src/itemdb.d(295): Assertion failure when performing a --single-directory sync
This commit is contained in:
parent
41976ed216
commit
9520fe7716
12
src/itemdb.d
12
src/itemdb.d
|
@ -141,6 +141,18 @@ final class ItemDatabase
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns if an item id is in the database
|
||||||
|
bool idInLocalDatabase(const(string) driveId, const(string)id)
|
||||||
|
{
|
||||||
|
selectItemByIdStmt.bind(1, driveId);
|
||||||
|
selectItemByIdStmt.bind(2, id);
|
||||||
|
auto r = selectItemByIdStmt.exec();
|
||||||
|
if (!r.empty) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// returns the item with the given path
|
// returns the item with the given path
|
||||||
// the path is relative to the sync directory ex: "./Music/Turbo Killer.mp3"
|
// the path is relative to the sync directory ex: "./Music/Turbo Killer.mp3"
|
||||||
bool selectByPath(const(char)[] path, string rootDriveId, out Item item)
|
bool selectByPath(const(char)[] path, string rootDriveId, out Item item)
|
||||||
|
|
20
src/sync.d
20
src/sync.d
|
@ -389,15 +389,19 @@ final class SyncEngine
|
||||||
}
|
}
|
||||||
// Yes .. ID is still on OneDrive but elsewhere .... #341 edge case handling
|
// Yes .. ID is still on OneDrive but elsewhere .... #341 edge case handling
|
||||||
// What is the original local path for this ID in the database? Does it match 'syncFolderName'
|
// What is the original local path for this ID in the database? Does it match 'syncFolderName'
|
||||||
string originalLocalPath = itemdb.computePath(driveId, item["id"].str);
|
if (itemdb.idInLocalDatabase(driveId, item["id"].str)){
|
||||||
|
// item is in the database
|
||||||
if (canFind(originalLocalPath, syncFolderName)){
|
string originalLocalPath = itemdb.computePath(driveId, item["id"].str);
|
||||||
// This 'change' relates to an item that WAS in 'syncFolderName' but is now
|
if (canFind(originalLocalPath, syncFolderName)){
|
||||||
// stored elsewhere on OneDrive - outside the path we are syncing from
|
// This 'change' relates to an item that WAS in 'syncFolderName' but is now
|
||||||
// Remove this item locally as it's local path is now obsolete
|
// stored elsewhere on OneDrive - outside the path we are syncing from
|
||||||
idsToDelete ~= [driveId, item["id"].str];
|
// Remove this item locally as it's local path is now obsolete
|
||||||
|
idsToDelete ~= [driveId, item["id"].str];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.vlog("Remote Change Discarded: ", item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue